This commit is contained in:
Paidax
2025-04-09 17:07:11 +08:00
parent 9e565d7665
commit 62f0b38ec3
24 changed files with 385 additions and 164 deletions
@@ -24,6 +24,7 @@ import io.v.nutz.zhgh.activity.models.ActivityTissuePerson;
import io.v.nutz.zhgh.activity.services.ActivitySchoolService;
import io.v.nutz.zhgh.activity.services.ActivityTissueService;
import io.v.nutz.zhgh.mobileHome.service.MobileHomeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
@@ -58,6 +59,7 @@ import java.util.List;
* @description: 分工会活动信息管理
**/
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/activity/info/mange")
@@ -315,7 +317,9 @@ public class ActivityUnionManageController {
@At
@Ok("void")
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
public void doExportUser(String id, @Param(value = "unionId", required = false) String unionId, HttpServletResponse response) throws IOException {
public void doExportUser(String id, @Param(value = "unionId", required = false) String unionId,
@Param(value = "isSign", required = false) Boolean isSign,
HttpServletResponse response) throws IOException {
Sql sql = Sqls.create("""
SELECT
u.id,
@@ -325,7 +329,9 @@ public class ActivityUnionManageController {
u.unionname,
u.sex,
u.mobile,
atp.applyDateTime
atp.applyDateTime,
IF(atp.isSign = 1, '已签到', '未签到') AS signState,
signTime
FROM
`activity_tissue_person` atp
LEFT JOIN `user` u ON u.id = atp.userId
@@ -334,8 +340,13 @@ public class ActivityUnionManageController {
Cnd cnd = Cnd.NEW();
cnd.and("atp.tissueId", "=", id);
cnd.andEX("u.unionId", "=", unionId);
if (isSign) {
cnd.and("atp.isSign", "=", 1);
}
sql.setCondition(cnd);
ActivityTissue tissue = tissuePersonService.dao().fetch(ActivityTissue.class, Cnd.where("id", "=", id));
List<ActivityTissuePerson> tissuePeople = tissuePersonService.listEntity(sql);
List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
@@ -344,12 +355,16 @@ public class ActivityUnionManageController {
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
entityList.add(new ExcelExportEntity("单位", "unitName", 20));
entityList.add(new ExcelExportEntity("工会", "unionName", 20));
if (isSign) {
entityList.add(new ExcelExportEntity("签到状态", "singState", 20));
entityList.add(new ExcelExportEntity("签到时间", "signTime", 20));
}
try {
ViTool.excelResponse(response, "参赛人数.xls");
ViTool.excelResponse(response, tissue.getName() + (isSign ? "签到" : "报名") + "人员信息表.xlsx");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, tissuePeople);
workbook.write(response.getOutputStream());
} catch (Exception e) {
log.error("参赛人员导出失败:{}", e.getMessage());
}
}
@@ -12,6 +12,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
@@ -81,7 +82,6 @@ public class ActivityUnionUserStatisticsController {
return null;
}
}
}
Sql sql = Sqls.create("""
@@ -95,7 +95,9 @@ public class ActivityUnionUserStatisticsController {
u.mobile,
atp.applyUserId,
atp.id atpId ,
atp.applyDateTime
atp.applyDateTime,
IF(atp.isSign = 1, '已签到', '未签到') AS signState,
signTime
FROM
`activity_tissue_person` atp
LEFT JOIN `user` u ON u.id = atp.userId
@@ -113,8 +115,11 @@ public class ActivityUnionUserStatisticsController {
// }
// }
// }
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
if (StrUtil.isNotBlank(page.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or("u.loginname", "LIKE", "%" + page.getSearchKeyword() + "%");
seg.or("u.username", "LIKE", "%" + page.getSearchKeyword() + "%");
cnd.and(seg);
}
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");