use of com.bc.pmpheep.back.plugin.PageParameter in project pmph by BCSquad.
the class WriterPointLogController method list.
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页查询用户积分获取记录列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ResponseBean list(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNumber") Integer pageNumber, @RequestParam("userId") Long userId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
PageParameter<WriterPointLogVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
WriterPointLogVO writerPointLogVO = new WriterPointLogVO();
writerPointLogVO.setUserId(userId);
writerPointLogVO.setStartTime(startTime);
writerPointLogVO.setEndTime(endTime);
pageParameter.setParameter(writerPointLogVO);
return new ResponseBean(writerPointLogService.getListWriterPointLog(pageParameter));
}
use of com.bc.pmpheep.back.plugin.PageParameter in project pmph by BCSquad.
the class WriterPointRuleController method list.
/**
* 分页查询积分规则列表
* @param pageSize
* @param pageNumber
* @param ruleCode
* @param ruleName
* @return
*/
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页查询积分规则列表")
@RequestMapping(value = "/pointrule/list", method = RequestMethod.GET)
public ResponseBean list(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNumber") Integer pageNumber, @RequestParam("ruleCode") String ruleCode, @RequestParam("ruleName") String ruleName) {
PageParameter<WriterPointRuleVO> pageParameter = new PageParameter<WriterPointRuleVO>(pageNumber, pageSize);
WriterPointRuleVO writerPointRuleVO = new WriterPointRuleVO();
writerPointRuleVO.setRuleName(ruleName);
writerPointRuleVO.setRuleCode(ruleCode);
pageParameter.setParameter(writerPointRuleVO);
return new ResponseBean(writerPointRuleService.getListWriterPointRule(pageParameter));
}
use of com.bc.pmpheep.back.plugin.PageParameter in project pmph by BCSquad.
the class MigrationStageSix method declaration.
/**
* 作家申报表
*/
protected void declaration() {
// 要迁移的旧库表名
String tableName = "writer_declaration";
// 增加new_pk字段
JdbcHelper.addColumn(tableName);
String sql = "select wd.writerid,wd.materid,wd.writername,s.usercode,s.username," + "wd.sex,wd.birthdate,wd.seniority,wd.duties,wd.positional,wd.address," + "wd.postcode,wd.handset,wd.email,wd.idcardtype," + "IFNULL(wd.idcardtype,0) idcardtype," + "wd.idcard,wd.linktel,wd.fax,tm.new_pk tm_materid," + "s.new_pk sys_userid,wd.unitid,bo.new_pk org_id,wd.workunit,bo.orgcode," + "case when wd.submittype=10 then 0 " + "when wd.submittype=11 and ta.auditstate=10 then 1 " + "when ta.auditstate=12 and wd.submittype=11 then 2 " + "when ta.auditstate=11 and wd.submittype=11 then 3 " + "when wd.submittype=11 then 1 " + "when wd.submittype=12 then 2 " + "end online_progress,wd.submittype,ta.auditstate,ta.auditdate," + "case when eup.new_pk is not null then eup.new_pk else null " + "end auth_user_id," + "case when ta.isreceivedpaper=1 then 2 " + "when ta.isreceivedpaper=0 then 0 " + "when ta.isreceivedpaper is null then 0 " + "end offline_progress," + "ta.isreceivedpaper,ta.editauditstate," + "case when wd.submittype=10 then 1 " + "else 0 end is_staging,wd.submittype,ta.editauditdate," + "wd.userid,s.sysflag,su.usertype " + "from writer_declaration wd " + "left join teach_material tm on tm.materid=wd.materid " + "left join ba_organize bo on bo.orgid=wd.unitid " + "left join sys_user s on s.userid=wd.userid " + "left join sys_userext su on su.userid=wd.userid " + "left join (select writerid,auditstate,auditid,editauditid,auditdate," + "isreceivedpaper,editauditstate,editauditdate " + "from teach_applyposition group by writerid) ta " + "left join sys_user eup on eup.userid = ta.editauditid " + "on ta.writerid=wd.writerid ";
// 查询所有数据
List<Map<String, Object>> maps = JdbcHelper.getJdbcTemplate().queryForList(sql);
// 迁移成功的条目数
int count = 0;
int materialidCount = 0;
int sysflagCount = 0;
int usertypeCount = 0;
int useridCount = 0;
int decCount = 0;
int realNameCount = 0;
List<Map<String, Object>> excel = new LinkedList<>();
Map<String, Object> result = new LinkedHashMap<>();
// 统计正常数据的数量
int correctCount = 0;
// 判断该数据是否有相应异常情况的标识
int[] state = { 0, 0, 0, 0, 0, 0, 0 };
StringBuilder reason = new StringBuilder();
StringBuilder dealWith = new StringBuilder();
/* 开始遍历查询结果 */
for (Map<String, Object> map : maps) {
StringBuilder sb = new StringBuilder();
// 旧表主键值
String id = (String) map.get("writerid");
// 教材id
Long materialid = (Long) map.get("tm_materid");
// 作家id
Long userid = (Long) map.get("sys_userid");
// 申报表作家姓名
String realName = (String) map.get("writername");
// 性别
String sexJudge = (String) map.get("sex");
// 教龄
String experienceNum = (String) map.get("seniority");
// 邮编
String postCode = (String) map.get("postcode");
// 申报单位id
Long orgId = (Long) map.get("org_id");
// 审核进度
Long onlineProgressJudge = (Long) map.get("online_progress");
// 审核人id
Long authUserid = (Long) map.get("auth_user_id");
// 纸质表进度
Long offlineProgressJudge = (Long) map.get("offline_progress");
// 是否暂存
Long isStagingJudge = (Long) map.get("is_staging");
// 旧表申报单位id
String unitid = (String) map.get("unitid");
// 0为后台用户,1为前台用户
Integer sysflag = (Integer) map.get("sysflag");
// 2为学校管理员
Integer usertype = (Integer) map.get("usertype");
// 机构代码去除空格截取
// 机构代码
String orgcode = (String) map.get("orgcode");
String orgCodes = null;
if (orgcode != null && !orgcode.equals("") && orgcode.length() > 3) {
// 去除空格截取
orgCodes = orgcode.trim().substring(0, 3);
}
if (ObjectUtil.isNull(sysflag) || sysflag.equals(0)) {
map.put(SQLParameters.EXCEL_EX_HEADER, sb.append("找到为后台用户申报教材。"));
excel.add(map);
logger.debug("找到为后台用户申报教材,此结果将被记录在Excel中");
sysflagCount++;
if (state[0] == 0) {
reason.append("申报教材的对应人员为社内用户。");
dealWith.append("放弃迁移。");
state[0] = 1;
}
continue;
}
if (usertype.equals(2)) {
map.put(SQLParameters.EXCEL_EX_HEADER, sb.append("找到为用户类型为学校管理员申报教材。"));
excel.add(map);
logger.debug("找到为用户类型为学校管理员申报教材,此结果将被记录在Excel中");
usertypeCount++;
if (state[1] == 0) {
reason.append("申报教材的对应人员为机构管理员用户。");
dealWith.append("放弃迁移。");
state[1] = 1;
}
continue;
}
Declaration declaration = new Declaration();
if (ObjectUtil.isNull(materialid) || materialid.intValue() == 0) {
map.put(SQLParameters.EXCEL_EX_HEADER, sb.append("未找到教材对应的关联结果。"));
excel.add(map);
logger.debug("未找到教材对应的关联结果,此结果将被记录在Excel中");
materialidCount++;
if (state[2] == 0) {
reason.append("找不到用户申报的教材。");
dealWith.append("放弃迁移。");
state[2] = 1;
}
continue;
}
declaration.setMaterialId(materialid);
if (ObjectUtil.isNull(userid) || userid.intValue() == 0) {
map.put(SQLParameters.EXCEL_EX_HEADER, sb.append("未找到作家对应的关联结果。"));
excel.add(map);
logger.debug("未找到作家对应的关联结果,此结果将被记录在Excel中");
useridCount++;
if (state[3] == 0) {
reason.append("找不到申报人员是哪一位用户。");
dealWith.append("放弃迁移。");
state[3] = 1;
}
continue;
} else {
if ("7d4856e6-99ca-48fb-9205-3704c01a109e".equals(id)) {
WriterUserManagerVO vo = new WriterUserManagerVO();
vo.setUsername("18045661072");
PageParameter<WriterUserManagerVO> param = new PageParameter<>(1, 1, vo);
PageResult<WriterUserManagerVO> list = writerUserService.getListWriterUser(param, null);
if (list.getRows().isEmpty()) {
map.put(SQLParameters.EXCEL_EX_HEADER, sb.append("未找到'18045661072-李勇'对应的关联结果。"));
excel.add(map);
logger.debug("未找到'18045661072-李勇'对应的关联结果,此结果将被记录在Excel中");
useridCount++;
if (state[4] == 0) {
reason.append("未找到申报人员李勇所对应的系统用户。");
dealWith.append("放弃迁移。");
state[4] = 1;
}
continue;
}
declaration.setUserId(list.getRows().get(0).getId());
} else {
declaration.setUserId(userid);
}
}
if (StringUtil.isEmpty(realName) && isStagingJudge.intValue() == 0) {
// 申报表作家姓名为空并且没有暂存
map.put(SQLParameters.EXCEL_EX_HEADER, sb.append("找到申报表作家姓名为空并且没有暂存。"));
realNameCount++;
if (state[5] == 0) {
reason.append("已提交申报表的作家找不到真实姓名。");
dealWith.append("照常迁入。");
state[5] = 1;
}
/*excel.add(map);
logger.debug("找到申报表作家姓名为空并且没有暂存,此结果将被记录在Excel中");
continue;*/
} else {
declaration.setRealname(realName);
}
if (StringUtil.isEmpty(sexJudge)) {
declaration.setSex(1);
} else {
// 性别
Integer sex = Integer.parseInt(sexJudge.trim());
declaration.setSex(sex);
}
// 生日
declaration.setBirthday((Date) map.get("birthdate"));
if (JdbcHelper.judgeExperience(experienceNum)) {
experienceNum = JdbcHelper.correctExperience(experienceNum);
}
// 教龄
declaration.setExperience(Integer.parseInt(experienceNum));
// 工作单位
declaration.setOrgName((String) map.get("workunit"));
// 职务
declaration.setPosition((String) map.get("duties"));
// 职称
declaration.setTitle((String) map.get("positional"));
// 联系地址
declaration.setAddress((String) map.get("address"));
if (StringUtil.strLength(postCode) > 20 || "55894b98-6b15-4210-9460-11bdf6e8e89c".equals(id)) {
declaration.setPostcode("100000");
} else if ("097674e55b094bb58e99c09f12b4e124".equals(id)) {
declaration.setPostcode("434020");
} else if ("245328b530b04523ab26e6b70d7764d8".equals(id)) {
declaration.setPostcode("211199");
} else {
// 邮编
declaration.setPostcode(postCode);
}
// 手机
declaration.setHandphone((String) map.get("handset"));
// 邮箱
declaration.setEmail((String) map.get("email"));
// 证件类型
declaration.setIdtype((Short) map.get("idcardtype1"));
// 手机
declaration.setHandphone((String) map.get("handset"));
String idcard = (String) map.get("idcard");
if (StringUtil.notEmpty(idcard)) {
if (idcard.length() > 20) {
idcard = idcard.substring(0, 19);
}
}
// 证件号码
declaration.setIdcard(idcard);
// 证件类型
declaration.setIdtype((Short) map.get("idcardtype1"));
// 联系电话
declaration.setTelephone((String) map.get("linktel"));
// 传真
declaration.setFax((String) map.get("fax"));
// 服从调剂
declaration.setIsDispensed(false);
// 参与本科教学评估认证
declaration.setIsUtec(false);
// 学历
declaration.setDegree(0);
// 专业特长
declaration.setExpertise(null);
/* 修改一个特殊情况 */
if ("a4大小、128g铜板、彩印、正反面、2000册,印刷费1600元".equals(declaration.getHandphone())) {
declaration.setHandphone(null);
// 证件号码
declaration.setIdcard(null);
// 联系电话
declaration.setTelephone(null);
// 传真
declaration.setFax(null);
}
// 旧表申报单位id为5的或者机构代码截取为15-的把orgid设置成0
if ("5".equals(unitid) || "15-".equals(orgCodes) || (ObjectUtil.isNull(orgId) && isStagingJudge.intValue() == 0)) {
// 0为人民卫生出版社
declaration.setOrgId(0L);
} else {
// 申报单位id
declaration.setOrgId(orgId);
}
if (ObjectUtil.notNull(onlineProgressJudge)) {
// 审核进度
Integer onlineProgress = onlineProgressJudge.intValue();
declaration.setOnlineProgress(onlineProgress);
} else {
declaration.setOnlineProgress(0);
}
declaration.setAuthUserId(authUserid);
// 审核通过时间
declaration.setAuthDate((Timestamp) map.get("auditdate"));
if (ObjectUtil.notNull(offlineProgressJudge)) {
// 纸质表进度
Integer offlineProgress = offlineProgressJudge.intValue();
declaration.setOfflineProgress(offlineProgress);
} else {
declaration.setOfflineProgress(0);
}
// 纸质表收到时间
declaration.setPaperDate((Timestamp) map.get("editauditdate"));
// 退回原因
declaration.setReturnCause(null);
if (ObjectUtil.isNull(isStagingJudge)) {
declaration.setIsStaging(false);
} else {
// 是否暂存
Integer isStaging = isStagingJudge.intValue();
if (isStaging.equals(0)) {
declaration.setIsStaging(false);
} else {
declaration.setIsStaging(true);
}
}
// 是否被逻辑删除
declaration.setIsDeleted(false);
if (declaration.getUserId() == null) {
logger.info("userId为空的作家名称为:{}", declaration.getRealname());
} else {
// logger.info("当前执行的作家id:{}", declaration.getUserId().toString());
}
Declaration dec = declarationService.getDeclarationByMaterialIdAndUserId(declaration.getMaterialId(), declaration.getUserId());
if (dec != null) {
map.put(SQLParameters.EXCEL_EX_HEADER, sb.append("已存在教材id和作家id均相同的记录。"));
excel.add(map);
logger.error("已存在教材id和作家id均相同的记录,本条数据放弃插入,material_id={},user_id={}", declaration.getMaterialId(), declaration.getUserId());
decCount++;
if (state[6] == 0) {
reason.append("同一用户申报同一教材的记录多于1条。");
dealWith.append("放弃迁移。");
state[6] = 1;
}
continue;
}
declaration = declarationService.addDeclaration(declaration);
long pk = declaration.getId();
// 更新旧表中new_pk字段
JdbcHelper.updateNewPrimaryKey(tableName, pk, "writerid", id);
count++;
if (null == map.get("exception")) {
correctCount++;
}
}
if (excel.size() > 0) {
try {
excelHelper.exportFromMaps(excel, "作家申报表", "declaration");
} catch (IOException ex) {
logger.error("异常数据导出到Excel失败", ex);
}
}
if (correctCount != maps.size()) {
result.put(SQLParameters.EXCEL_HEADER_TABLENAME, "declaration");
result.put(SQLParameters.EXCEL_HEADER_DESCRIPTION, "作家申报表");
result.put(SQLParameters.EXCEL_HEADER_SUM_DATA, maps.size());
result.put(SQLParameters.EXCEL_HEADER_MIGRATED_DATA, count);
result.put(SQLParameters.EXCEL_HEADER_CORECT_DATA, correctCount);
result.put(SQLParameters.EXCEL_HEADER_TRANSFERED_DATA, count - correctCount);
result.put(SQLParameters.EXCEL_HEADER_NO_MIGRATED_DATA, maps.size() - count);
result.put(SQLParameters.EXCEL_HEADER_EXCEPTION_REASON, reason.toString());
result.put(SQLParameters.EXCEL_HEADER_DEAL_WITH, dealWith.toString());
SQLParameters.STATISTICS_RESULT.add(result);
}
logger.info("申报表作家姓名为空并且不是暂存表数量:{}", realNameCount);
logger.info("后台用户申报教材数量:{}", sysflagCount);
logger.info("用户类型为学校管理员申报教材数量:{}", usertypeCount);
logger.info("未找到作家对应的关联结果数量:{}", useridCount);
logger.info("教材id和作家id均相同的记录数量:{}", decCount);
logger.info("未找到教材对应的关联结果数量:{}", materialidCount);
logger.info("writer_declaration表迁移完成,异常条目数量:{}", excel.size());
logger.info("原数据库中共有{}条数据,迁移了{}条数据", maps.size(), count);
// 记录信息
Map<String, Object> msg = new HashMap<>();
msg.put("result", "" + tableName + " 表迁移完成" + count + "/" + maps.size());
SQLParameters.STATISTICS.add(msg);
}
use of com.bc.pmpheep.back.plugin.PageParameter in project pmph by BCSquad.
the class BookServiceTest method testListBookVO.
@Test
public void testListBookVO() {
// listBookVO 分页初始化/查询图书详情
PageParameter<BookVO> pageParameter = new PageParameter<>(1, 1);
BookVO bookVO = new BookVO();
bookVO.setName("书名1");
bookVO.setIsNew(true);
bookVO.setPath(null);
bookVO.setIsOnSale(true);
bookVO.setIsPromote(true);
pageParameter.setParameter(bookVO);
PageResult<BookVO> pageResult = bookService.listBookVO(pageParameter);
Assert.assertTrue("查询结果为空:", pageResult.getRows().isEmpty());
}
use of com.bc.pmpheep.back.plugin.PageParameter in project pmph by BCSquad.
the class FileDownLoadController method orgUserExportEcel.
/**
* 机构用户export
*/
@RequestMapping(value = "/orgUserExportEcel", method = RequestMethod.GET)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "导出excel")
@ResponseBody
public void orgUserExportEcel(HttpServletRequest request, HttpServletResponse response, String name, String orgName, String orgTypeName, Integer isHospital) {
PageParameter pageParameter = new PageParameter<>();
OrgAndOrgUserVO orgAndOrgUserVO = new OrgAndOrgUserVO();
if (StringUtil.notEmpty(orgName)) {
orgAndOrgUserVO.setOrgName(orgName.replaceAll(" ", ""));
}
if (StringUtil.notEmpty(name)) {
// 去除空格
orgAndOrgUserVO.setName(name.replaceAll(" ", ""));
}
if (StringUtil.notEmpty(orgTypeName)) {
// 去除空格
orgAndOrgUserVO.setOrgTypeName(orgTypeName.replaceAll(" ", ""));
}
orgAndOrgUserVO.setIsHospital(isHospital);
pageParameter.setParameter(orgAndOrgUserVO);
pageParameter.setStart(null);
// export
Workbook workbook = null;
List<OrgAndOrgUserVO> orgList = null;
try {
orgList = orgUserService.getListOrgUser(pageParameter).getRows();
workbook = excelHelper.fromBusinessObjectList(orgList, "机构账户信息");
} catch (CheckedServiceException | IllegalArgumentException | IllegalAccessException e) {
logger.warn("数据表格化的时候失败");
}
response.setCharacterEncoding("utf-8");
response.setContentType("application/force-download");
String fileName = returnFileName(request, "机构账户信息.xls");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
try (OutputStream out = response.getOutputStream()) {
workbook.write(out);
out.flush();
out.close();
} catch (Exception e) {
logger.warn("文件下载时出现IO异常:{}", e.getMessage());
throw new CheckedServiceException(CheckedExceptionBusiness.FILE, CheckedExceptionResult.FILE_DOWNLOAD_FAILED, "文件在传输时中断");
}
}
Aggregations