first commit
This commit is contained in:
+117
@@ -0,0 +1,117 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareMemberAddress;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareAddressManageController
|
||||
* @Description 福利地址管理
|
||||
* @Author zhf
|
||||
* @Date 2024/4/30 9:49
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/addressManage")
|
||||
public class WelfareAddressManageController {
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/addressManage/index.html")
|
||||
@SaCheckPermission("welfare.addressManage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("welfare.addressManage")
|
||||
public Result selectUserAddress(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
userName ,
|
||||
tel,
|
||||
addressDetail,
|
||||
isDefault,
|
||||
province,
|
||||
city,
|
||||
county,
|
||||
areaCode
|
||||
FROM
|
||||
`welfare_member_address`
|
||||
WHERE userId = @userId
|
||||
ORDER BY
|
||||
isDefault DESC
|
||||
""");
|
||||
sql.setParam("userId", StrUtil.isNotBlank(userId) ? userId : SecurityUtil.getUserId());
|
||||
return Result.success(baseService.listMap(sql));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改默认地址
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("welfare.addressManage")
|
||||
public Result doDefault(String id) {
|
||||
baseService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", false),
|
||||
Cnd.where("userId", "=", SecurityUtil.getUserId()));
|
||||
baseService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", true),
|
||||
Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.addressManage")
|
||||
public Result deleteAddress(String id) {
|
||||
baseService.dao().clear(WelfareMemberAddress.class, Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存地址
|
||||
*
|
||||
* @param welfareMemberAddress
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.addressManage")
|
||||
public Result doSaveUserAddress(@Param("data") WelfareMemberAddress welfareMemberAddress) {
|
||||
String userId = StrUtil.isNotBlank(welfareMemberAddress.getUserId()) ? welfareMemberAddress.getUserId() : SecurityUtil.getUserId();
|
||||
if (welfareMemberAddress.isDefault()) {
|
||||
baseService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", false),
|
||||
Cnd.where("userId", "=", userId));
|
||||
}
|
||||
welfareMemberAddress.setUserId(userId);
|
||||
baseService.dao().insertOrUpdate(welfareMemberAddress);
|
||||
return Result.success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/common")
|
||||
public class WelfareCommonController {
|
||||
|
||||
@Inject
|
||||
private WelfareProjectService projectService;
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare")
|
||||
@ApiOperation("获取项目列表")
|
||||
public Result list(Integer year) {
|
||||
return Result.success(projectService.getWelfareList(year));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare")
|
||||
@ApiOperation("获取项目信息")
|
||||
public Result projectInfo(@Valid String id) {
|
||||
return Result.success(projectService.projectInfo(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.model.ExcelImportRes;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.easyexcel.EasyExcelUtil;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.zhgh.welfare.mode.WelfareUserImportExcel;
|
||||
import com.budwk.app.zhgh.welfare.mode.WelfareUserTemp;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareFilterUserPageForm;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareListPageForm;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/list/mange")
|
||||
@Api(tags = "福利名单")
|
||||
@Slf4j
|
||||
public class WelfareListController {
|
||||
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
@Inject
|
||||
private WelfareProjectService welfareProjectService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/welfareUser/index.html")
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
|
||||
public Result pageData(@Valid @Param("pageForm") WelfareListPageForm pageForm) {
|
||||
if (StrUtil.isBlank(pageForm.getProjectId())) {
|
||||
return Result.success(new Pagination<>(1, 10, 0, Collections.emptyList()));
|
||||
}
|
||||
Pagination pagination = welfareListService.pageData(pageForm);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("查询福利会员")
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@SLog(tag = "福利名单管理", msg = "管理员删除某个福利会员")
|
||||
public Result delete(String projectId, String userId, String id) {
|
||||
welfareListService.delete(id);
|
||||
welfareListService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId).and("selectUserId", "=", userId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@ApiOperation("分页查询非福利会员")
|
||||
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
|
||||
public Result notWelfareUserPageData(@Valid @Param("pageForm") WelfareFilterUserPageForm pageForm) {
|
||||
return Result.success(welfareListService.notWelfareUserPageData(pageForm));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@ApiOperation("添加用户到福利名单")
|
||||
public Result addWelfareUser(@Valid @Param("pageForm") WelfareFilterUserPageForm pageForm) {
|
||||
welfareListService.addWelfareUser(pageForm);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@ApiOperation("导出")
|
||||
@Ok("void")
|
||||
public void exportXlsx(@Param("pageForm") WelfareListPageForm pageForm, HttpServletResponse response) {
|
||||
welfareListService.exportXlsx(pageForm, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@ApiOperation("编辑备注")
|
||||
public Result updateRemark(@Param("remark") String remark, @Param("id") @Valid String id) {
|
||||
welfareListService.update(Chain.make("remark", remark), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@ApiOperation("下载模版")
|
||||
public void downloadTemplate(HttpServletResponse response) {
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, Collections.emptyList());
|
||||
CommonDownloadUtil.download("福利名单模版.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Result doImport(TempFile file, @Valid String businessId, @Valid Boolean isFlag) {
|
||||
List<T> ts = EasyExcelUtil.syncReadModel(file.getFile(), WelfareUserTemp.class, 0, 1);
|
||||
List<WelfareUserTemp> mdList = JSONUtil.parseArray(JSONUtil.toJsonStr(ts)).toList(WelfareUserTemp.class);
|
||||
List<String> loginNames = mdList.stream().map(WelfareUserTemp::getLoginname).collect(Collectors.toList());
|
||||
List<View_user> sysUsers = welfareListService.dao().query(View_user.class, Cnd.where("loginname", "in", loginNames));
|
||||
|
||||
List<WelfareList> welfareLists = new ArrayList<>();
|
||||
|
||||
if (isFlag) {
|
||||
welfareListService.clear(Cnd.where("projectId", "=", businessId));
|
||||
}
|
||||
//返回错误记录
|
||||
List<WelfareUserTemp> errorInfos = new ArrayList<>();
|
||||
for (WelfareUserTemp v : mdList) {
|
||||
View_user user = sysUsers.stream().filter(s -> s.getLoginname().equals(v.getLoginname())).findFirst().orElse(null);
|
||||
if (user != null) {
|
||||
WelfareList list = new WelfareList();
|
||||
list.setUserId(user.getId());
|
||||
list.setWelfareUnitId(user.getUnitId());
|
||||
list.setWelfareUnitName(user.getUnitName());
|
||||
list.setWelfareUnionId(user.getUnionId());
|
||||
list.setWelfareUnionName(user.getUnionName());
|
||||
list.setProjectId(businessId);
|
||||
// list.setWelfareSecondLevelUnitId(user.getUnitId());
|
||||
list.setPersonType(user.getPersonType());
|
||||
list.setUserState(user.getUserState());
|
||||
welfareLists.add(list);
|
||||
} else {
|
||||
v.setErrorInfo("数据库暂无此人请检查工号");
|
||||
errorInfos.add(v);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
welfareListService.insert(welfareLists);
|
||||
//如果有错误数据就返回给前端
|
||||
if (Lang.isNotEmpty(errorInfos)) {
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
nutMap.setv("totalCount", mdList.size());
|
||||
nutMap.setv("successCount", Math.max(mdList.size() - errorInfos.size(), 0));
|
||||
nutMap.setv("errorCount", errorInfos.size());
|
||||
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||
return NutMap.NEW().addv("工号", v.getLoginname()).addv("姓名", v.getUsername()).addv("错误原因", v.getErrorInfo());
|
||||
}).collect(Collectors.toList()));
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
return Result.success("导入成功");
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SLog(tag = "福利名单管理", msg = "导入福利名单")
|
||||
public Result importByExcel(@Param("file") TempFile tempFile, @Param("projectId") String projectId) {
|
||||
// 读取数据
|
||||
List<WelfareUserImportExcel> excelList = ExcelImportUtil.importExcel(tempFile.getFile(), WelfareUserImportExcel.class, new ImportParams());
|
||||
|
||||
// 查询用户
|
||||
List<String> loginNames = excelList.stream().map(WelfareUserImportExcel::getLoginName).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
List<View_user> sysUsers = welfareListService.dao().query(View_user.class, Cnd.where(View_user::getLoginname, "in", loginNames));
|
||||
|
||||
// 查询当前的福利会员
|
||||
List<WelfareList> welfareLists = welfareListService.query(Cnd.where("projectId", "=", projectId));
|
||||
|
||||
// 创建结果集
|
||||
ExcelImportRes<WelfareUserImportExcel> excelImportRes = new ExcelImportRes<>();
|
||||
excelImportRes.setTotalRecords(excelList.size());
|
||||
|
||||
|
||||
for (int i = 0; i < excelList.size(); i++) {
|
||||
WelfareUserImportExcel excel = excelList.get(i);
|
||||
if (StrUtil.isBlank(excel.getLoginName())) {
|
||||
excel.setErrInfo("工号为空", i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 不能在excel里重复
|
||||
if (excelList.stream().filter(s -> s.getLoginName().equals(excel.getLoginName())).count() > 1) {
|
||||
excel.setErrInfo("重复数据", i + 1);
|
||||
}
|
||||
|
||||
View_user user = sysUsers.stream().filter(s -> s.getLoginname().equals(excel.getLoginName())).findFirst().orElse(null);
|
||||
if (user == null) {
|
||||
excel.setErrInfo("无此用户", i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (welfareLists.stream().anyMatch(s -> s.getUserId().equals(user.getId()))) {
|
||||
excel.setErrInfo("该用户已加入福利名单", i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
WelfareList wl = new WelfareList();
|
||||
wl.setProjectId(projectId);
|
||||
wl.setUserId(user.getId());
|
||||
wl.setWelfareUnitId(user.getUnitId());
|
||||
wl.setWelfareUnitName(user.getUnitName());
|
||||
wl.setWelfareUnionId(user.getUnionId());
|
||||
wl.setWelfareUnionName(user.getUnionName());
|
||||
wl.setPersonType(user.getPersonType());
|
||||
wl.setPreparedBy(user.getPreparedBy());
|
||||
wl.setUserState(user.getUserState());
|
||||
try {
|
||||
welfareListService.insert(wl);
|
||||
} catch (Exception e) {
|
||||
log.error("添加福利名单失败:{}", e.getMessage());
|
||||
excel.setErrInfo("添加失败", i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加错误记录
|
||||
excelImportRes.setErrorDetails(excelList.stream().filter(s -> StrUtil.isNotBlank(s.getErrMsg())).collect(Collectors.toList()));
|
||||
excelImportRes.setFailedCount(excelImportRes.getErrorDetails().size());
|
||||
excelImportRes.setSuccessCount(excelList.size() - excelImportRes.getFailedCount());
|
||||
|
||||
return Result.success(excelImportRes);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import com.budwk.app.zhgh.welfare.utils.ExpressSelectUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareMineController
|
||||
* @Description 我的福利
|
||||
* @Author zhf
|
||||
* @Date 2024/8/13 11:34
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/mine")
|
||||
public class WelfareMineController {
|
||||
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
@Inject
|
||||
private WelfareProjectService welfareProjectService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
@Inject
|
||||
private ExpressSelectUtil expressSelectUtil;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/mine/index.html")
|
||||
@SaCheckPermission("welfare.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.mine")
|
||||
public Result pageData(PageForm pageForm,
|
||||
Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wp.*,
|
||||
wp.id AS projectId,
|
||||
CASE
|
||||
WHEN wus.selectUserId IS NOT NULL THEN
|
||||
1 ELSE 0
|
||||
END AS isChoose,
|
||||
GROUP_CONCAT(DISTINCT wuso.optionName ,'(',wus.selectNum,'份)') AS gist_list,
|
||||
wus.receiveAddress,
|
||||
wl.userId
|
||||
FROM
|
||||
welfare_list wl
|
||||
LEFT JOIN welfare_project wp ON wp.id = wl.projectId
|
||||
LEFT JOIN welfare_project_user_selection wus ON wl.projectId = wus.welfareId
|
||||
AND wus.selectUserId = @selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("selectUserId", SecurityUtil.getUserId());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wp.isDisabled", "=", 0);
|
||||
cnd.andEX("YEAR(wp.choiceTimeStart)", "=", year);
|
||||
cnd.andEX("wl.userId", "=", SecurityUtil.getUserId());
|
||||
cnd.desc("wp.choiceTimeStart");
|
||||
cnd.groupBy("wl.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = welfareListService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.mine")
|
||||
public Result getUserSelection(String projectId, String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wpus.id AS selectId,
|
||||
wpus.subjectId,
|
||||
wpus.selectOptionId,
|
||||
wpus.receiveAddress,
|
||||
wpso.optionName,
|
||||
wpus.selectNum,
|
||||
wpus.userSign,
|
||||
wpus.courierNumber,
|
||||
wpus.selectTime,
|
||||
wpso.imgUrl,
|
||||
wpso.simpleDesc,
|
||||
wpso.supplier,
|
||||
(select COUNT(1) FROM welfare_evaluate we WHERE we.projectId=@projectId AND we.optionId=wpso.id) isPj
|
||||
FROM
|
||||
`welfare_project_user_selection` wpus
|
||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||
WHERE
|
||||
welfareId = @projectId
|
||||
AND selectUserId = @userId
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
sql.setParam("userId", StrUtil.isNotBlank(userId) ? userId : SecurityUtil.getUserId());
|
||||
return Result.success(welfareListService.listMap(sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.mine")
|
||||
public Result isChoice(String projectId) {
|
||||
int count = welfareListService.dao().count(WelfareList.class,
|
||||
Cnd.where("projectId", "=", projectId).and("userId", "=", SecurityUtil.getUserId())
|
||||
.and("isReceive", "=", true));
|
||||
return Result.success().addData(count > 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareFilterUserPageForm;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareProjectMangeController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/12 17:28
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/project/mange")
|
||||
public class WelfareProjectMangeController {
|
||||
|
||||
@Inject
|
||||
private WelfareProjectService projectService;
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/projectMange/index.html")
|
||||
@SaCheckPermission("welfare.project.mange")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.project.mange")
|
||||
public Result pageData(PageForm pageForm,
|
||||
Integer year,
|
||||
String name) {
|
||||
|
||||
Sql sql = Sqls.create("SELECT project.* FROM `welfare_project` project $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageForm.defaultSortDesc("createdAt");
|
||||
|
||||
cnd.andEX("year", "=", year);
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.and(Cnd.likeEX("name", name));
|
||||
}
|
||||
|
||||
cnd.desc("project.choiceTimeStart");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return Result.success(projectService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "福利", msg = "新增/编辑了福利")
|
||||
@SaCheckPermission("welfare.project.mange")
|
||||
public Result save(@Param("data") WelfareProject project) {
|
||||
if (StrUtil.isNotBlank(project.getId())) {
|
||||
projectService.updateProject(project);
|
||||
} else {
|
||||
projectService.saveProject(project);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目的信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("welfare")
|
||||
public Result findOne(String id) {
|
||||
return Result.success(projectService.projectInfo(id));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.project.mange")
|
||||
public Result projectStatusChange(String id, boolean val) {
|
||||
projectService.update(Chain.make("isDisabled", !val), Cnd.where("id", "=", id));
|
||||
projectService.dao().update(Sys_home_activity.class,
|
||||
Chain.make("enable", val),
|
||||
Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.project.mange")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result delete(String id) {
|
||||
projectService.deleteWelfare(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.mine")
|
||||
public Result getWelfareList(Integer year) {
|
||||
return Result.success(projectService.getWelfareList(year));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成福利名单用户查询
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("welfare.project.mange")
|
||||
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
|
||||
public Result filterUserPageData(@Valid @Param("pageForm") WelfareFilterUserPageForm pageForm) {
|
||||
Pagination pagination = welfareListService.notWelfareUserPageData(pageForm);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加福利名单用户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("welfare.project.mange")
|
||||
public Result addWelfareUser(@Valid @Param("pageForm") WelfareFilterUserPageForm pageForm) {
|
||||
welfareListService.addWelfareUser(pageForm);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/selection/situation")
|
||||
@Slf4j
|
||||
@Api(tags = "选择情况")
|
||||
public class WelfareSelectionSituationController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
@Inject
|
||||
private WelfareStatisticsService welfareStatisticsService;
|
||||
@Inject
|
||||
private WelfareSelectionSituationService situationService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/selectionSituation/index.html")
|
||||
@SaCheckPermission("welfare.selection.situation")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.selection.situation")
|
||||
@ApiOperation("分页查询")
|
||||
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
|
||||
public Result pageData(@Valid @Param("pageForm") WelfareSelectionSituationPageForm pageForm) {
|
||||
if (StrUtil.isBlank(pageForm.getProjectId())) {
|
||||
return Result.success(new Pagination<>(1, 10, 0, Collections.emptyList()));
|
||||
}
|
||||
Pagination pagination = situationService.pageData(pageForm);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.selection.situation")
|
||||
@ApiOperation("获取某个用户选择信息")
|
||||
public Result getUserSelection(String projectId, String userId) {
|
||||
List<WelfareUserSelection> list = dao.query(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", userId));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "welfare", tag = "选择福利", msg = "代选福利")
|
||||
@SaCheckPermission("welfare.selection.situation")
|
||||
public Result confirmSelect(@Param("selections") WelfareUserSelection[] selections, String projectId, String userId) {
|
||||
int count = dao.count(WelfareList.class, Cnd.where(WelfareList::getProjectId, "=", projectId).and(WelfareList::getUserId, "=", userId));
|
||||
if (count == 0) {
|
||||
return Result.error("此用户没有选择的权限");
|
||||
}
|
||||
|
||||
//删除上次选择的
|
||||
dao.clear(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", userId));
|
||||
for (WelfareUserSelection welfareUserSelection : selections) {
|
||||
welfareUserSelection.setWelfareId(projectId);
|
||||
welfareUserSelection.setSelectUserId(userId);
|
||||
welfareUserSelection.setSelectTime(new Date());
|
||||
}
|
||||
dao.insert(selections);
|
||||
return Result.success("选择成功");
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.selection.situation")
|
||||
@Ok("void")
|
||||
@ApiOperation("导出Excel")
|
||||
public void exportXlsx(@Valid @Param("pageForm") WelfareSelectionSituationPageForm pageForm, HttpServletResponse response) {
|
||||
situationService.exportXlsx(pageForm, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result getMobileByUserId(String userId) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, userId);
|
||||
return Result.success().addData(user.getMobile());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareSingleService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/statistics")
|
||||
@Slf4j
|
||||
@Api(tags = "福利统计")
|
||||
public class WelfareStatisticsController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private WelfareSingleService welfareSingleService;
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
@Inject
|
||||
private WelfareStatisticsService welfareStatisticsService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/statistics/index.html")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
public Result pageData(String projectId, String unionId) {
|
||||
NutMap data = welfareStatisticsService.pageData(projectId, unionId);
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@ApiOperation("查询某分工会已选择人员")
|
||||
public Result selectedUnionUserPageData(@Valid PageForm pageForm, String projectId, String unionId) {
|
||||
Pagination pagination = welfareStatisticsService.selectedUnionUserPageData(pageForm, projectId, unionId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@ApiOperation("导出某分工会已选择人员")
|
||||
public void exportSelectedUnionUser(String projectId, String unionId, HttpServletResponse response) {
|
||||
welfareStatisticsService.exportSelectedUnionUser(projectId, unionId, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@ApiOperation("查询某分工会未选择人员")
|
||||
public Result unSelectedUnionUserPageData(@Valid PageForm pageForm, String projectId, String unionId) {
|
||||
Pagination pagination = welfareStatisticsService.unSelectedUnionUserPageData(pageForm, projectId, unionId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@ApiOperation("导出某分工会未选择人员")
|
||||
public void exportUnSelectedUnionUser(String projectId, String unionId, HttpServletResponse response) {
|
||||
welfareStatisticsService.exportUnSelectedUnionUser(projectId, unionId, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@ApiOperation("导出各分工会选择情况")
|
||||
public void exportUnionExcel(String projectId, HttpServletResponse response) {
|
||||
welfareStatisticsService.exportUnionExcel(projectId, response);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@ApiOperation("按福利选项导出")
|
||||
public void exportByWelfareOptions(String projectId, HttpServletResponse response) {
|
||||
welfareStatisticsService.exportByWelfareOptions(projectId, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@ApiOperation("导出汇总表")
|
||||
public void exportSummary(String projectId, HttpServletResponse response) {
|
||||
welfareStatisticsService.exportSummary(projectId, response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @param response
|
||||
* @author zhf
|
||||
* @description 导出签领表
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
public void exportReceiveDetailByUnionIdWord(String projectId, String unionId, HttpServletResponse response) {
|
||||
WelfareProject welfareProject = welfareSingleService.dao().fetch(WelfareProject.class, projectId);
|
||||
Sys_union sysUnion = welfareSingleService.dao().fetch(Sys_union.class, Cnd.where("id", "=", unionId));
|
||||
try {
|
||||
Workbook workbook = welfareSingleService.exportReceiveDetail(projectId, unionId);
|
||||
CommonDownloadUtil.download(sysUnion.getUnionCode() + sysUnion.getName() + welfareProject.getName() + "签收表.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @param flag
|
||||
* @param response
|
||||
* @author zhf
|
||||
* @description 导出已选为选
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
public void exportReceiveDetailByUnionId(String projectId, String unionId, Boolean flag, HttpServletResponse response) {
|
||||
|
||||
welfareSingleService.exportReceiveDetailByUnionId(projectId, unionId, flag, response);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
public void allExportReceiveDetailByUnionIdWord(String projectId, HttpServletResponse response) {
|
||||
try {
|
||||
WelfareProject welfareProject = welfareSingleService.dao().fetch(WelfareProject.class, projectId);
|
||||
List<Sys_union> unions = welfareSingleService.dao().query(Sys_union.class, Cnd.NEW());
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(welfareProject.getName() + "签收表.zip", "UTF-8"));
|
||||
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
for (Sys_union union : unions) {
|
||||
String fileName = union.getUnionCode() + union.getName().replaceAll("/", "、") + welfareProject.getName() + "签收表.xlsx";
|
||||
zipOutputStream.putNextEntry(new ZipEntry(fileName));
|
||||
Workbook workbook = welfareSingleService.exportReceiveDetail(projectId, union.getId());
|
||||
workbook.write(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
}
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
public void exportSelectData(String projectId, String unionId, HttpServletResponse response) {
|
||||
welfareListService.exportSelectData(projectId, unionId, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
public void exportSummary(String projectId, String unionId, HttpServletResponse response) {
|
||||
// welfareSingleService.exportSummary(projectId, unionId, response);
|
||||
welfareStatisticsService.exportSummary(projectId,response);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.statistics")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "福利统计", msg = "管理员代选福利")
|
||||
@ApiOperation("管理员代选福利")
|
||||
public Result doSelectByAdmin(@Valid String projectId, @Param("welfareOptions") @Valid String welfareOptions) {
|
||||
welfareSingleService.doSelectByAdmin(projectId, welfareOptions);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareUserChooseController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/13 15:10
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/userChoose")
|
||||
public class WelfareUserChooseController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/userChoose/index.html")
|
||||
@SaCheckPermission("welfare.user.choose")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.user.choose")
|
||||
public Result pageData(PageForm pageForm, Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wp.*,
|
||||
CASE
|
||||
WHEN wus.selectUserId IS NOT NULL THEN 1
|
||||
ELSE 0
|
||||
END AS isChoose,
|
||||
wus.selectTime,
|
||||
GROUP_CONCAT(DISTINCT wuso.optionName ,'(',wus.selectNum,'份)') AS gist_list,
|
||||
wus.receiveAddress
|
||||
FROM
|
||||
welfare_project wp
|
||||
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
|
||||
INNER JOIN welfare_list wl ON wp.id = wl.projectId AND wl.userId = @selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("selectUserId", SecurityUtil.getUserId());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wp.provideMode", "in", "2,3");
|
||||
cnd.andEX("YEAR(wp.choiceTimeStart)", "in", year);
|
||||
cnd.and("wp.isDisabled", "=", 0);
|
||||
cnd.groupBy("wp.id");
|
||||
cnd.desc("YEAR(wp.choiceTimeStart)");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "welfare", tag = "选择福利", msg = "福利")
|
||||
@SaCheckPermission("welfare.user.choose")
|
||||
public Result confirmSelect(@Param("welfareUserSelections") WelfareUserSelection[] welfareUserSelections, String projectId) {
|
||||
//删除上次选择的
|
||||
baseService.dao().clear(WelfareUserSelection.class,
|
||||
Cnd.where("welfareId", "=", projectId)
|
||||
.and("selectUserId", "=", SecurityUtil.getUserId()));
|
||||
|
||||
for (WelfareUserSelection welfareUserSelection : welfareUserSelections) {
|
||||
welfareUserSelection.setSelectUserId(SecurityUtil.getUserId());
|
||||
welfareUserSelection.setSelectTime(new Date());
|
||||
}
|
||||
|
||||
baseService.dao().insert(welfareUserSelections);
|
||||
|
||||
baseService.dao().update(WelfareList.class,
|
||||
Chain.make("isReceive", true),
|
||||
Cnd.where("projectId", "=", projectId)
|
||||
.and("userId", "=", SecurityUtil.getUserId()));
|
||||
return Result.success("选择成功");
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.user.choose")
|
||||
@ApiOperation("获取用户选择信息")
|
||||
public Result getUserSelection(String projectId) {
|
||||
List<WelfareUserSelection> list = dao.query(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", SecurityUtil.getUserId()));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/welfare/userSelect")
|
||||
public class WelfareUserSelectController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private WelfareProjectService welfareProjectService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/select/index.html")
|
||||
@SaCheckPermission("welfare.user.select")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.user.select")
|
||||
@ApiOperation("获取用户选择列表分页")
|
||||
public Result pageData(PageForm pageForm, Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wp.*,
|
||||
CASE
|
||||
WHEN wus.selectUserId IS NOT NULL THEN 1
|
||||
ELSE 0
|
||||
END AS isChoose,
|
||||
wus.selectTime,
|
||||
GROUP_CONCAT(DISTINCT wuso.optionName ,'(',wus.selectNum,'份)') AS gist_list,
|
||||
wus.receiveAddress
|
||||
FROM
|
||||
welfare_project wp
|
||||
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
|
||||
INNER JOIN welfare_list wl ON wp.id = wl.projectId AND wl.userId = @selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("selectUserId", SecurityUtil.getUserId());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wp.provideMode", "in", "2,3");
|
||||
cnd.andEX("YEAR(wp.choiceTimeStart)", "in", year);
|
||||
cnd.and("wp.isDisabled", "=", 0);
|
||||
cnd.groupBy("wp.id");
|
||||
cnd.desc("YEAR(wp.choiceTimeStart)");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = welfareProjectService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "welfare", tag = "选择福利", msg = "福利")
|
||||
@SaCheckPermission("welfare.user.select")
|
||||
public Result confirmSelect(@Param("selections") WelfareUserSelection[] selections, String projectId) {
|
||||
int count = dao.count(WelfareList.class, Cnd.where(WelfareList::getProjectId, "=", projectId).and(WelfareList::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (count == 0) {
|
||||
return Result.error("您没有选择的权限");
|
||||
}
|
||||
WelfareProject project = dao.fetch(WelfareProject.class, projectId);
|
||||
|
||||
int sum = Arrays.stream(selections).mapToInt(selection -> Objects.requireNonNullElse(selection.getSelectNum(), 0)).sum();
|
||||
if (sum > project.getMultiSelectNum()) {
|
||||
return Result.error("选择的数量不能超过" + project.getMultiSelectNum());
|
||||
}
|
||||
|
||||
|
||||
//删除上次选择的
|
||||
dao.clear(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", SecurityUtil.getUserId()));
|
||||
for (WelfareUserSelection welfareUserSelection : selections) {
|
||||
welfareUserSelection.setWelfareId(projectId);
|
||||
welfareUserSelection.setSelectUserId(SecurityUtil.getUserId());
|
||||
welfareUserSelection.setSelectTime(new Date());
|
||||
}
|
||||
dao.insert(selections);
|
||||
return Result.success("选择成功");
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.user.select")
|
||||
@ApiOperation("获取用户选择信息")
|
||||
public Result getUserSelection(String projectId) {
|
||||
List<WelfareUserSelection> list = dao.query(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", SecurityUtil.getUserId()));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.budwk.app.zhgh.welfare.h5Controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName H5WelfareAddressController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/9/26 19:56
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/welfare/address")
|
||||
public class H5WelfareAddressController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/welfare/address/list.html")
|
||||
@SaCheckPermission("hs.welfare.address")
|
||||
public void list() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.budwk.app.zhgh.welfare.h5Controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName H5WelfareMineController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/9/27 9:11
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/welfare/mine")
|
||||
public class H5WelfareMineController {
|
||||
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/welfare/mine/list.html")
|
||||
@SaCheckPermission("hs.welfare.mine")
|
||||
public void list() {
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.budwk.app.zhgh.welfare.h5Controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName H5WelfareUserChooseController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/9/26 9:21
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/welfare/userSelect")
|
||||
public class H5WelfareUserSelectController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/welfare/select/list.html")
|
||||
@SaCheckPermission("hs.welfare.user.select")
|
||||
public void list() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/welfare/select/index.html")
|
||||
@SaCheckPermission("hs.welfare.user.select")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/welfare/select/success.html")
|
||||
@SaCheckPermission("hs.welfare.user.select")
|
||||
public void success() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.budwk.app.zhgh.welfare.listener;
|
||||
|
||||
import com.budwk.app.base.event.user.SysUserEvent;
|
||||
import com.budwk.app.base.event.user.SysUserEventListener;
|
||||
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:WelfareListener
|
||||
* @Date 2024/11/29 18:15
|
||||
* @注释
|
||||
*/
|
||||
@IocBean
|
||||
public class WelfareListener implements SysUserEventListener {
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void onEvent(SysUserEvent event) {
|
||||
if (event.getMemberChangeType() != MemberChangeType.UNIT_CHANGE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.budwk.app.zhgh.welfare.mode;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CourierNumberExcelMode {
|
||||
|
||||
@Excel(name = "工号", width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "快递单号1", width = 30)
|
||||
private String oneCourierNumber;
|
||||
|
||||
@Excel(name = "快递单号2", width = 30)
|
||||
private String twoCourierNumber;
|
||||
|
||||
@Excel(name = "快递单号3", width = 30)
|
||||
private String threeCourierNumber;
|
||||
|
||||
@Excel(name = "快递单号4", width = 30)
|
||||
private String fourCourierNumber;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.budwk.app.zhgh.welfare.mode;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName ExportEntityTc
|
||||
* @Description 导出套餐模版
|
||||
* @Author zhf
|
||||
* @Date 2024/5/8 15:58
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class WelfareExportEntityTc {
|
||||
@Excel(name = "工号", width = 20d)
|
||||
private String loginName;
|
||||
|
||||
@Excel(name = "姓名", width = 20d)
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "所属工会", width = 20d)
|
||||
private String unionName;
|
||||
|
||||
// @Excel(name = "所属单位", width = 60d)
|
||||
// private String unitName;
|
||||
|
||||
@Excel(name = "已选福利", width = 80d)
|
||||
private String optionName;
|
||||
|
||||
@Excel(name = "收货信息", width = 100d)
|
||||
private String receiveAddress;
|
||||
|
||||
@Excel(name = "快递单号", width = 40d)
|
||||
private String courierNumber;
|
||||
|
||||
@Excel(name = "实名签字", width = 20d, type = 2 , imageType = 2)
|
||||
private byte[] qzBytes;
|
||||
|
||||
private String userSign;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.welfare.mode;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.budwk.app.base.model.ExcelImportError;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class WelfareUserImportExcel extends ExcelImportError {
|
||||
|
||||
@Excel(name = "工号")
|
||||
private String loginName;
|
||||
|
||||
@Excel(name = "姓名")
|
||||
private String userName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.budwk.app.zhgh.welfare.mode;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareUserTemp
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/11/11 14:44
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@ContentRowHeight(20) // 内容行高
|
||||
@HeadRowHeight(20) // 表头行高
|
||||
@ColumnWidth(25) //列宽
|
||||
public class WelfareUserTemp {
|
||||
|
||||
@ExcelProperty("工号")
|
||||
private String loginname;
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
@ExcelIgnore
|
||||
private String errorInfo;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareCourierNumber
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/6/27 9:46
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table
|
||||
@Comment("福利用户快递单号")
|
||||
public class WelfareCourierNumber extends BaseModel implements Serializable {
|
||||
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("所属福利")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareId;
|
||||
|
||||
@Column
|
||||
@Comment("选择项")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String selectOptionId;
|
||||
|
||||
@Column
|
||||
@Comment("选择用户")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String selectUserId;
|
||||
|
||||
@Column
|
||||
@Comment("快递单号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String courierNumber;
|
||||
|
||||
@Column
|
||||
@Comment("物流信息")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private WelfareUserSelection.LogisticsTrace logisticsTrace;
|
||||
|
||||
@Column
|
||||
@Comment("上次查询物流信息的时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date selectExpressDate;
|
||||
|
||||
@Data
|
||||
public static class LogisticsTrace {
|
||||
//运单号物流流转当前最新变更时间
|
||||
private Date theLastTime;
|
||||
//运单号物流流转当前最新描述
|
||||
private String theLastMessage;
|
||||
//运单号当前物流状态文字描述
|
||||
private String logisticsStatusDesc;
|
||||
//物流流转状态(WAIT_ACCEPT:)
|
||||
private String logisticsStatus;
|
||||
//物流流转明细
|
||||
private List<NutMap> logisticsTraceDetailList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareEvaluate
|
||||
* @Description 福利评价
|
||||
* @Author zhf
|
||||
* @Date 2024/5/7 18:47
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
public class WelfareEvaluate extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@Column
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("福利项目ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String projectId;
|
||||
|
||||
@Column
|
||||
@Comment("套餐ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String optionId;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("评分")
|
||||
@ColDefine(type = ColType.DOUBLE,width = 2,precision = 1)
|
||||
private Double evaluateScore;
|
||||
|
||||
@Column
|
||||
@Comment("评价内容")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String evaluateText;
|
||||
|
||||
@Column
|
||||
@Comment("评价时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date applyDate;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* 福利名单
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/2/1
|
||||
* @since 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("welfare_list")
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_WELFARE_LIST_USER_ID", fields = {"userId"}, unique = false),
|
||||
@Index(name = "INDEX_WELFARE_LIST_WELFARE_UNIT_ID", fields = {"welfareUnitId"}, unique = false),
|
||||
})
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class WelfareList extends BaseModel{
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("福利项目ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String projectId;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("福利单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("福利单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String welfareUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("福利分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("福利分工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("人员类型")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String personType;
|
||||
|
||||
@Column
|
||||
@Comment("在职状态")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String userState;
|
||||
|
||||
@Column
|
||||
@Comment("聘用方式")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String preparedBy;
|
||||
|
||||
@Deprecated
|
||||
@Column
|
||||
@Comment("福利二级单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareSecondLevelUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("是否签收")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isReceive;
|
||||
|
||||
@Column
|
||||
@Comment("是否下次福利自动选择当前提货券")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isAutoSelect;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 福利会员地址信息
|
||||
* @createTime 2022年01月14日 09:49:00
|
||||
*/
|
||||
@Table("welfare_member_address")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class WelfareMemberAddress extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("收货人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("收货人手机号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 11)
|
||||
private String tel;
|
||||
|
||||
@Column
|
||||
@Comment("省份")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String province;
|
||||
|
||||
@Column
|
||||
@Comment("城市")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String city;
|
||||
|
||||
@Column
|
||||
@Comment("区县")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String county;
|
||||
|
||||
@Column
|
||||
@Comment("详细地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String addressDetail;
|
||||
|
||||
@Column
|
||||
@Comment("地区编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String areaCode;
|
||||
|
||||
@Column
|
||||
@Comment("是否为默认地址")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isDefault;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 福利项目
|
||||
*
|
||||
* @author: 1V
|
||||
* @date: 2021/2/26
|
||||
* @since 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table
|
||||
@Comment("福利项目")
|
||||
public class WelfareProject extends BaseModel implements SysHomeConvert {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("年度")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@Comment("任务id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String taskId;
|
||||
|
||||
@Column
|
||||
@Comment("项目名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("节日")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String festival;
|
||||
|
||||
@Column
|
||||
@Comment("发放开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date provideTimeStart;
|
||||
|
||||
@Column
|
||||
@Comment("发放结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date provideTimeEnd;
|
||||
|
||||
@Column
|
||||
@Comment("选择开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date choiceTimeStart;
|
||||
|
||||
@Column
|
||||
@Comment("选择结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date choiceTimeEnd;
|
||||
|
||||
@Column
|
||||
@Comment("逾期补发结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date overdueChoiceTimeEnd;
|
||||
|
||||
@Column
|
||||
@Comment("发放地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String provideAddress;
|
||||
|
||||
@Column
|
||||
@Comment("发放地址坐标")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String provideCoordinate;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("发放形式")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer provideMode;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("签收形式")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer signMode;
|
||||
|
||||
@Column
|
||||
@Comment("是否弹性福利")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean flexible;
|
||||
|
||||
@Column
|
||||
@Comment("是否推送移动端首页")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer isPushHome;
|
||||
|
||||
@Column
|
||||
@Comment("是否福利套餐")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isRoutine;
|
||||
|
||||
@Column
|
||||
@Comment("选择模式(checkBox多选 radio单选)")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String isCheckBox;
|
||||
|
||||
@Column
|
||||
@Comment("最多选几个")
|
||||
@Default("1")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer multiSelectNum;
|
||||
|
||||
@Column
|
||||
@Comment("是否支持单个多选")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean singleOptionSupportMultipleSelection;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("主福利礼品")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String gift;
|
||||
|
||||
@Column
|
||||
@Comment("弹性礼品")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Gift> flexibleGifts;
|
||||
|
||||
@Column
|
||||
@Comment("福利所属分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("选择套餐Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String schoolWelfareId;
|
||||
|
||||
|
||||
/**
|
||||
* 弹性礼品
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Gift {
|
||||
/**
|
||||
* 礼品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 是否默认
|
||||
*/
|
||||
private Boolean isDefault;
|
||||
}
|
||||
|
||||
@Column
|
||||
@Comment("条件")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String conditionStructureId;
|
||||
|
||||
@Many(field = "projectId")
|
||||
private List<WelfareProjectSubject> welfareProjectSubjects;
|
||||
|
||||
/**
|
||||
* 套餐选项
|
||||
*/
|
||||
@Many(field = "welfareId")
|
||||
private List<WelfareProjectSubjectOption> options;
|
||||
|
||||
@Column
|
||||
@Comment("题目ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String subjectId;
|
||||
|
||||
@Column
|
||||
@Comment("封面")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@Comment("是否全年生日蛋糕卷")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isYearBirthday;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@Default("0")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isDisabled;
|
||||
|
||||
@Override
|
||||
public Sys_home_activity covertToSysHomeActivity() {
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(this.getId());
|
||||
sysHomeActivity.setName(this.getName());
|
||||
sysHomeActivity.setCover(this.getCover());
|
||||
sysHomeActivity.setUrl("/platform/welfare/userSelect");
|
||||
sysHomeActivity.setH5Url("/platform/h5/welfare/userSelect/index?id=" + this.getId());
|
||||
sysHomeActivity.setStartDate(this.getChoiceTimeStart());
|
||||
sysHomeActivity.setEndDate(this.getChoiceTimeEnd());
|
||||
sysHomeActivity.setAllowUserSql("select userId from welfare_list where projectId = '" + this.getId() + "' and userId = @userId");
|
||||
sysHomeActivity.setEnable(true);
|
||||
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
|
||||
return sysHomeActivity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 福利项目题目
|
||||
* @createTime 2022年01月12日 16:58:00
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("welfare_project_subject")
|
||||
@Comment("福利选项标题")
|
||||
public class WelfareProjectSubject extends BaseModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("所属福利")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String projectId;
|
||||
|
||||
@Column
|
||||
@Comment("题目名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String subjectName;
|
||||
|
||||
@Column
|
||||
@Comment("题目类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String subjectType;
|
||||
|
||||
@Column
|
||||
@Comment("本题总共最多选几项")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private String subjectMaxSelectNum;
|
||||
|
||||
@Many(field = "subjectId")
|
||||
private List<WelfareProjectSubjectOption> options;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月12日 17:03:00
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("welfare_project_subject_option")
|
||||
@Comment("福利选项")
|
||||
public class WelfareProjectSubjectOption extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("所属福利")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String subjectId;
|
||||
|
||||
@Column
|
||||
@Comment("所属福利")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareId;
|
||||
|
||||
@Column
|
||||
@Comment("选项类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String optionType;
|
||||
|
||||
@Column
|
||||
@Comment("选项名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String optionName;
|
||||
|
||||
@Column
|
||||
@Comment("选项名称Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String optionNameId;
|
||||
|
||||
@Column
|
||||
@Comment("选项排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer optionSort;
|
||||
|
||||
@Column
|
||||
@Comment("没选系统自动选")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isDefaultOption;
|
||||
|
||||
@Column
|
||||
@Comment("默认选项")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isSystemDefault;
|
||||
|
||||
@Column
|
||||
@Comment("是否快递")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isExpressDelivery;
|
||||
|
||||
@Column
|
||||
@Comment("图片地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String imgUrl;
|
||||
|
||||
@Column
|
||||
@Comment("供应商id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String shoppingId;
|
||||
|
||||
@Column
|
||||
@Comment("供应商名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String shoppingName;
|
||||
|
||||
@Column
|
||||
@Comment("说明描述")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Comment("供货商")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
private String supplier;
|
||||
|
||||
@Column
|
||||
@Comment("简短备注")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
private String simpleDesc;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.budwk.app.zhgh.welfare.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月12日 17:07:00
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("welfare_project_user_selection")
|
||||
@Comment("福利用户选择记录")
|
||||
public class WelfareUserSelection extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("所属福利")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareId;
|
||||
|
||||
@Column
|
||||
@Comment("所属题目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String subjectId;
|
||||
|
||||
@Column
|
||||
@Comment("选择项")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String selectOptionId;
|
||||
|
||||
@Column
|
||||
@Comment("选择用户")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String selectUserId;
|
||||
|
||||
@Column
|
||||
@Comment("选择时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date selectTime;
|
||||
|
||||
@Column
|
||||
@Comment("收货地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String receiveAddress;
|
||||
|
||||
@Column
|
||||
@Comment("用户签字")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String userSign;
|
||||
|
||||
@Column
|
||||
@Comment("快递单号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String courierNumber;
|
||||
|
||||
@Column
|
||||
@Comment("是否签收")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isReceive;
|
||||
|
||||
@Column
|
||||
@Comment("选择数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer selectNum;
|
||||
|
||||
@Column
|
||||
@Comment("手机号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("物流信息")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private LogisticsTrace logisticsTrace;
|
||||
|
||||
@Column
|
||||
@Comment("上次查询物流信息的时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date selectExpressDate;
|
||||
|
||||
@Data
|
||||
public static class LogisticsTrace {
|
||||
//运单号物流流转当前最新变更时间
|
||||
private Date theLastTime;
|
||||
//运单号物流流转当前最新描述
|
||||
private String theLastMessage;
|
||||
//运单号当前物流状态文字描述
|
||||
private String logisticsStatusDesc;
|
||||
//物流流转状态(WAIT_ACCEPT:)
|
||||
private String logisticsStatus;
|
||||
//物流流转明细
|
||||
private List<NutMap> logisticsTraceDetailList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.budwk.app.zhgh.welfare.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("用户生成福利名单分页查询参数")
|
||||
public class WelfareFilterUserPageForm extends PageForm {
|
||||
|
||||
@ApiModelProperty("福利项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String loginName;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty("出生日期")
|
||||
private Date birthday;
|
||||
|
||||
@ApiModelProperty("出生月份")
|
||||
private String[] birthMonths;
|
||||
|
||||
@ApiModelProperty("工会id")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty("工会名称")
|
||||
private String unionName;
|
||||
|
||||
@ApiModelProperty("单位id")
|
||||
private String[] unitIds;
|
||||
|
||||
@ApiModelProperty("单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("人员类型")
|
||||
private String[] personTypes;
|
||||
|
||||
@ApiModelProperty("聘用方式")
|
||||
private String[] preparedBys;
|
||||
|
||||
@ApiModelProperty("在职状态")
|
||||
private String[] userStates;
|
||||
|
||||
@ApiModelProperty("是否会员")
|
||||
private Boolean isMember;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.budwk.app.zhgh.welfare.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(description = "福利名单分页查询参数")
|
||||
public class WelfareListPageForm extends PageForm {
|
||||
|
||||
@ApiModelProperty("年份")
|
||||
private Integer year;
|
||||
|
||||
@ApiModelProperty("福利项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String loginName;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty("出生日期")
|
||||
private Date birthday;
|
||||
|
||||
@ApiModelProperty("出生月份")
|
||||
private String[] birthMonths;
|
||||
|
||||
@ApiModelProperty("工会id")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty("工会名称")
|
||||
private String unionName;
|
||||
|
||||
@ApiModelProperty("单位id")
|
||||
private String[] unitIds;
|
||||
|
||||
@ApiModelProperty("单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("人员类型")
|
||||
private String[] personTypes;
|
||||
|
||||
@ApiModelProperty("聘用方式")
|
||||
private String[] preparedBys;
|
||||
|
||||
@ApiModelProperty("在职状态")
|
||||
private String[] userStates;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.budwk.app.zhgh.welfare.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("选择统计分页参数")
|
||||
public class WelfareSelectionSituationPageForm extends PageForm {
|
||||
|
||||
@ApiModelProperty("福利项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("福利选项id")
|
||||
private String welfareOptionId;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String loginName;
|
||||
|
||||
@ApiModelProperty("工会id")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty("单位id")
|
||||
private String[] unitIds;
|
||||
|
||||
@ApiModelProperty("是否已选择")
|
||||
private Boolean isSelect;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.budwk.app.zhgh.welfare.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareFilterUserPageForm;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareListPageForm;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public interface WelfareListService extends BaseService<WelfareList> {
|
||||
|
||||
void doExcelByOptionId(String projectId, String optionId, HttpServletResponse response);
|
||||
|
||||
void exportSelectData(String projectId, String unionId, HttpServletResponse response);
|
||||
|
||||
Result importCourierNumber(TempFile file, String projectId, String optionId);
|
||||
|
||||
void doEditWelfareData(String editWelfareData, String welfareOptions);
|
||||
|
||||
|
||||
Pagination selectNotWelfareList(String id, PageForm pageForm);
|
||||
|
||||
void doWelfareListUser(String[] ids,String id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(WelfareListPageForm pageForm);
|
||||
|
||||
/**
|
||||
* 查询非福利会员用户
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
Pagination notWelfareUserPageData(WelfareFilterUserPageForm pageForm);
|
||||
|
||||
/**
|
||||
* 添加福利会员用户
|
||||
* @param pageForm
|
||||
*/
|
||||
void addWelfareUser(WelfareFilterUserPageForm pageForm);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param pageForm
|
||||
* @param response
|
||||
*/
|
||||
void exportXlsx(WelfareListPageForm pageForm, HttpServletResponse response);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.budwk.app.zhgh.welfare.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
|
||||
public interface WelfareListSummaryService extends BaseService {
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.budwk.app.zhgh.welfare.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WelfareProjectService extends BaseService<WelfareProject> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取项目的信息
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
WelfareProject projectInfo(String projectId);
|
||||
|
||||
/**
|
||||
* 保存项目信息
|
||||
* @param project
|
||||
*/
|
||||
void saveProject(WelfareProject project);
|
||||
|
||||
/**
|
||||
* 修改项目信息
|
||||
* @param project
|
||||
*/
|
||||
void updateProject(WelfareProject project);
|
||||
|
||||
/**
|
||||
* 删除项目信息
|
||||
* @param id
|
||||
*/
|
||||
void deleteWelfare(String id);
|
||||
|
||||
/**
|
||||
* 创建福利名单
|
||||
* @param projectId
|
||||
* @param created
|
||||
*/
|
||||
void createList(String projectId, boolean created);
|
||||
|
||||
/**
|
||||
* 项目列表
|
||||
* @param year
|
||||
* @return
|
||||
*/
|
||||
List<WelfareProject> getWelfareList(Integer year);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.budwk.app.zhgh.welfare.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public interface WelfareSelectionSituationService extends BaseService<WelfareList> {
|
||||
|
||||
Pagination pageData(WelfareSelectionSituationPageForm pageForm);
|
||||
|
||||
void exportXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.budwk.app.zhgh.welfare.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
public interface WelfareSingleService extends BaseService {
|
||||
|
||||
/**
|
||||
* 查询各分工会已选未选的人数
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
NutMap pageData(String projectId, String unionId);
|
||||
|
||||
List<NutMap> getOptionByProjectId(String projectId);
|
||||
|
||||
List<NutMap> getUserSelectionByProjectId(String projectId);
|
||||
|
||||
/**
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @return java.lang.Object
|
||||
* @author zhf
|
||||
* @description 查询已选名单如果传了pageNumber和pageSize返回分页的数据,没传返回List<nutMap>
|
||||
*/
|
||||
Object receivePageData(String projectId, String unionId, Integer pageNumber, Integer pageSize);
|
||||
|
||||
/**
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @return org.apache.poi.ss.usermodel.Workbook
|
||||
* @author zhf
|
||||
* @description 导出
|
||||
*/
|
||||
Workbook exportReceiveDetail(String projectId, String unionId);
|
||||
|
||||
/**
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @return java.lang.Object
|
||||
* @author zhf
|
||||
* @description 查询已选名单如果传了pageNumber和pageSize返回分页的数据,没传返回List<nutMap>
|
||||
*/
|
||||
Object unclaimedData(String projectId, String unionId, Integer pageNumber, Integer pageSize);
|
||||
|
||||
void exportReceiveDetailByUnionId(String projectId, String unionId, Boolean flag, HttpServletResponse response);
|
||||
|
||||
void exportSummary(String projectId,String unionId, HttpServletResponse response);
|
||||
|
||||
|
||||
void doSelectByAdmin(String projectId, String welfareOptions);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.budwk.app.zhgh.welfare.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public interface WelfareStatisticsService extends BaseService<WelfareProject> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
NutMap pageData(String projectId, String unionId);
|
||||
|
||||
/**
|
||||
* 查询某分工会已选择人员
|
||||
* @param pageForm
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
*/
|
||||
Pagination selectedUnionUserPageData(PageForm pageForm, String projectId, String unionId);
|
||||
|
||||
/**
|
||||
* 导出某分工会已选择人员
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @param response
|
||||
*/
|
||||
void exportSelectedUnionUser(String projectId, String unionId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* Pagination
|
||||
* @param pageForm
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
*/
|
||||
Pagination unSelectedUnionUserPageData(PageForm pageForm, String projectId, String unionId);
|
||||
|
||||
/**
|
||||
* 导出某分工会未选择人员
|
||||
* @param projectId
|
||||
* @param unionId
|
||||
* @param response
|
||||
*/
|
||||
void exportUnSelectedUnionUser(String projectId, String unionId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导出各分工会选择情况
|
||||
* @param projectId
|
||||
* @param response
|
||||
*/
|
||||
void exportUnionExcel(String projectId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 按福利选项导出
|
||||
* @param projectId
|
||||
* @param response
|
||||
*/
|
||||
void exportByWelfareOptions(String projectId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导出汇总表
|
||||
*/
|
||||
void exportSummary(String projectId, HttpServletResponse response);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,620 @@
|
||||
package com.budwk.app.zhgh.welfare.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.mode.CourierNumberExcelMode;
|
||||
import com.budwk.app.zhgh.welfare.model.*;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareFilterUserPageForm;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareListPageForm;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareListServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/12 17:42
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> implements WelfareListService {
|
||||
public WelfareListServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doExcelByOptionId(String projectId, String optionId, HttpServletResponse response) {
|
||||
WelfareProject project = dao().fetch(WelfareProject.class, projectId);
|
||||
WelfareProjectSubjectOption subjectOption = dao().fetch(WelfareProjectSubjectOption.class, optionId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
wl.personType,
|
||||
un.name unionname,
|
||||
it.`name` unitname,
|
||||
wpus.selectNum
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
LEFT JOIN `welfare_list` wl ON wpus.selectUserId = wl.userId
|
||||
LEFT JOIN `sys_user` u ON u.id = wl.userId
|
||||
LEFT JOIN sys_union un ON un.id = wl.welfareUnitId
|
||||
LEFT JOIN sys_unit it ON it.id = wl.welfareSecondLevelUnitId
|
||||
WHERE
|
||||
wl.projectId = @welfareId
|
||||
AND wpus.selectOptionId = @selectOptionId and wpus.selectNum!=0
|
||||
|
||||
""").setParam("welfareId", projectId).setParam("selectOptionId", optionId);
|
||||
|
||||
List<NutMap> mapList = listMap(sql);
|
||||
|
||||
List<String> userId = mapList.stream().map(m -> m.getString("id")).collect(Collectors.toList());
|
||||
|
||||
List<WelfareCourierNumber> courierNumberList = dao().query(WelfareCourierNumber.class,
|
||||
Cnd.where("selectUserId", "in", userId)
|
||||
.and("welfareId", "=", projectId)
|
||||
.and("selectOptionId", "=", optionId));
|
||||
|
||||
List<String> nameList = List.of("one", "two", "three", "four");
|
||||
for (NutMap map : mapList) {
|
||||
List<WelfareCourierNumber> userCourierNumbers = courierNumberList.stream()
|
||||
.filter(c -> c.getSelectUserId().equals(map.getString("id"))).collect(Collectors.toList());
|
||||
for (int i = 0; i < userCourierNumbers.size(); i++) {
|
||||
map.setv(nameList.get(i) + "CourierNumber", userCourierNumbers.get(i).getCourierNumber());
|
||||
}
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("人员类别", "personType", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在部门", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("份数", "selectNum", 20));
|
||||
for (int i = 0; i < nameList.size(); i++) {
|
||||
exportEntities.add(new ExcelExportEntity("快递单号" + (i + 1), nameList.get(i) + "CourierNumber", 20));
|
||||
}
|
||||
|
||||
/* List<String> unitList = List.of("在职教职工", "劳务派遣", "空状态");
|
||||
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
for (String un : unitList) {
|
||||
List<NutMap> v = new ArrayList<>();
|
||||
if (un.equals("在职教职工")) {
|
||||
v = mapList.stream().filter(m -> StrUtil.isNotBlank(m.getString("personType")) &&
|
||||
(!m.getString("personType").equals("劳务人才派遣") && !m.getString("personType").equals("其他类"))
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
if (un.equals("劳务派遣")) {
|
||||
v = mapList.stream().filter(m -> StrUtil.isNotBlank(m.getString("personType")) &&
|
||||
(m.getString("personType").equals("劳务人才派遣") || m.getString("personType").equals("其他类"))).collect(Collectors.toList());
|
||||
}
|
||||
if (un.equals("空状态")) {
|
||||
v = mapList.stream().filter(m -> StrUtil.isBlank(m.getString("personType"))).collect(Collectors.toList());
|
||||
}
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(project.getName() + subjectOption.getOptionName() + "发放名单(" + un + ")");
|
||||
exportParams.setSheetName(un);
|
||||
service.createSheetForMap(workbook, exportParams, exportEntities, v);
|
||||
}*/
|
||||
try {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(project.getName() + subjectOption.getOptionName() + "发放名单");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, mapList);
|
||||
CommonDownloadUtil.download(project.getName() + subjectOption.getOptionName() + ".xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportSelectData(String projectId, String unionId, HttpServletResponse response) {
|
||||
WelfareProject welfareProject = dao().fetch(WelfareProject.class, Cnd.where("id", "=", projectId));
|
||||
String projectName = welfareProject.getName();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.mobile,
|
||||
un.name unionname,
|
||||
it.name unitname,
|
||||
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
||||
wpus.selectNum,
|
||||
wpso.optionName
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
left join `sys_user` u on u.id = wpus.selectUserId
|
||||
left join welfare_project_subject_option wpso on wpso.id = wpus.selectOptionId
|
||||
left join welfare_list wl on wl.userId = wpus.selectUserId and wl.projectId=wpus.welfareId
|
||||
LEFT JOIN sys_union un ON un.id = wl.welfareUnitId
|
||||
LEFT JOIN sys_unit it ON it.id = wl.welfareSecondLevelUnitId
|
||||
$condition
|
||||
""");
|
||||
cnd.and("wpus.welfareId", "=", projectId);
|
||||
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_WELFARE_ADMIN.name())) {
|
||||
cnd.and("wl.welfareUnitId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
cnd.andEX("wl.welfareUnitId", "=", unionId);
|
||||
cnd.groupBy("wpus.selectUserId", "wpus.selectOptionId");
|
||||
cnd.asc("it.unitcode");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
Map<String, List<NutMap>> optionGroupData = list.stream().collect(Collectors.groupingBy(v -> v.getString("optionName")));
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("电话号码", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 30));
|
||||
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 50));
|
||||
exportEntities.add(new ExcelExportEntity("选择份数", "selectNum", 20));
|
||||
exportEntities.add(new ExcelExportEntity("收货地址", "receiveAddress", 100));
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
optionGroupData.forEach((k, v) -> {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(projectName + k + "选择情况");
|
||||
exportParams.setSheetName(k);
|
||||
service.createSheetForMap(workbook, exportParams, exportEntities, v);
|
||||
});
|
||||
|
||||
try {
|
||||
CommonDownloadUtil.download(projectName + ".xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result importCourierNumber(TempFile file, String projectId, String optionId) {
|
||||
if (Lang.isEmpty(file)) {
|
||||
return Result.error("上传的文件不能为空");
|
||||
}
|
||||
String extName = FileUtil.extName(file.getFile());
|
||||
if (!List.of("xls", "xlsx").contains(extName.toLowerCase())) {
|
||||
return Result.error("请上传xls,xlsx文件");
|
||||
}
|
||||
|
||||
List<CourierNumberExcelMode> excelList;
|
||||
try {
|
||||
ImportParams importParams = new ImportParams();
|
||||
excelList = ExcelImportUtil.importExcel(file.getFile(), CourierNumberExcelMode.class, importParams);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("读取不到数据,请检查excel文件格式");
|
||||
}
|
||||
|
||||
if (Lang.isEmpty(excelList)) {
|
||||
return Result.error("读取不到数据,请检查excel文件格式");
|
||||
}
|
||||
|
||||
try {
|
||||
if (excelList.stream().anyMatch(v -> StrUtil.isBlank(v.getLoginName()))) {
|
||||
return Result.error("工号和快递单号不能为空");
|
||||
}
|
||||
|
||||
List<CourierNumberExcelMode> filterExcelList = excelList.stream().collect(Collectors.collectingAndThen(
|
||||
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CourierNumberExcelMode::getLoginName))),
|
||||
ArrayList::new
|
||||
));
|
||||
|
||||
|
||||
List<String> loginNameList = filterExcelList.stream().map(v -> v.getLoginName().replaceAll("\n", "").replaceAll("\t", "").trim()).collect(Collectors.toList());
|
||||
Sql loginNameSql = Sqls.create("select id,loginname from sys_user where loginname in (@loginNameList)");
|
||||
loginNameSql.setParam("loginNameList", loginNameList);
|
||||
List<NutMap> loginNameMaps = listMap(loginNameSql);
|
||||
|
||||
List<String> userIds = loginNameMaps.stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||
|
||||
|
||||
//根据福利和选项删除本次导入的快递单号
|
||||
dao().clear(WelfareCourierNumber.class,
|
||||
Cnd.where("welfareId", "=", projectId)
|
||||
.and("selectUserId", "in", userIds)
|
||||
.and("selectOptionId", "=", optionId));
|
||||
|
||||
List<WelfareCourierNumber> welfareCourierNumbers = new ArrayList<>();
|
||||
|
||||
|
||||
for (NutMap map : loginNameMaps) {
|
||||
String id = map.getString("id");
|
||||
String loginname = map.getString("loginname");
|
||||
CourierNumberExcelMode courierNumberExcelMode = filterExcelList.stream().filter(u -> u.getLoginName().replaceAll("\n", "").equals(loginname)).findFirst().orElse(null);
|
||||
|
||||
|
||||
List<String> courierNumberList = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(courierNumberExcelMode.getOneCourierNumber())) {
|
||||
courierNumberList.add(courierNumberExcelMode.getOneCourierNumber());
|
||||
}
|
||||
if (StrUtil.isNotBlank(courierNumberExcelMode.getTwoCourierNumber())) {
|
||||
courierNumberList.add(courierNumberExcelMode.getTwoCourierNumber());
|
||||
}
|
||||
if (StrUtil.isNotBlank(courierNumberExcelMode.getThreeCourierNumber())) {
|
||||
courierNumberList.add(courierNumberExcelMode.getThreeCourierNumber());
|
||||
}
|
||||
if (StrUtil.isNotBlank(courierNumberExcelMode.getFourCourierNumber())) {
|
||||
courierNumberList.add(courierNumberExcelMode.getFourCourierNumber());
|
||||
}
|
||||
|
||||
for (String number : courierNumberList) {
|
||||
WelfareCourierNumber courierNumber = new WelfareCourierNumber();
|
||||
courierNumber.setCourierNumber(number);
|
||||
courierNumber.setSelectUserId(id);
|
||||
courierNumber.setWelfareId(projectId);
|
||||
courierNumber.setSelectOptionId(optionId);
|
||||
welfareCourierNumbers.add(courierNumber);
|
||||
}
|
||||
}
|
||||
insert(welfareCourierNumbers);
|
||||
|
||||
return Result.success("导入成功");
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
return Result.error("导入快递单号失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEditWelfareData(String editWelfareData, String welfareOptions) {
|
||||
|
||||
NutMap editData = Json.fromJson(NutMap.class, editWelfareData);
|
||||
List<NutMap> optionList = Json.fromJsonAsList(NutMap.class, welfareOptions);
|
||||
dao().clear(WelfareUserSelection.class,
|
||||
Cnd.where("welfareId", "=", editData.getString("projectId"))
|
||||
.and("selectUserId", "=", editData.getString("userId")));
|
||||
List<WelfareUserSelection> userSelections = optionList.stream().map(v -> {
|
||||
WelfareUserSelection selection = new WelfareUserSelection();
|
||||
selection.setSelectTime(new Date());
|
||||
selection.setWelfareId(editData.getString("projectId"));
|
||||
selection.setSelectUserId(editData.getString("userId"));
|
||||
selection.setSelectOptionId(v.getString("id"));
|
||||
selection.setReceiveAddress(editData.getString("receiveAddress"));
|
||||
selection.setSubjectId(v.getString("subjectId"));
|
||||
selection.setSelectNum(v.getInt("selectNum"));
|
||||
return selection;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<WelfareUserSelection> userSelections1 = userSelections.stream().filter(v -> v.getSelectNum() > 0).collect(Collectors.toList());
|
||||
dao().insert(userSelections1);
|
||||
dao().update(WelfareList.class,
|
||||
Chain.make("isReceive", true),
|
||||
Cnd.where("projectId", "=", editData.getString("projectId"))
|
||||
.and("userId", "=", editData.getString("userId")));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination selectNotWelfareList(String id, PageForm pageForm) {
|
||||
List<WelfareList> welfareLists = query(id);
|
||||
List<String> userIds = welfareLists.stream().map(WelfareList::getUserId).collect(Collectors.toList());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
userState,
|
||||
personType,
|
||||
unitName,
|
||||
unionName
|
||||
FROM
|
||||
`vw_user`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("id", "not in", userIds);
|
||||
cnd.and("unionCode", "is not", null);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword()) && StrUtil.isNotBlank(pageForm.getSearchName())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.asc("userState").asc("unitCode").asc("unionCode");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWelfareListUser(String[] ids, String id) {
|
||||
|
||||
List<View_user> userList = dao().query(View_user.class, Cnd.where("id", "in", ids));
|
||||
List<WelfareList> welfareLists = userList.stream().map(v -> {
|
||||
WelfareList welfareList = new WelfareList();
|
||||
welfareList.setProjectId(id);
|
||||
welfareList.setUserId(v.getId());
|
||||
welfareList.setWelfareUnitId(v.getUnitId());
|
||||
welfareList.setWelfareUnitName(v.getUnitName());
|
||||
welfareList.setWelfareUnionId(v.getUnionId());
|
||||
welfareList.setWelfareUnionName(v.getUnionName());
|
||||
welfareList.setPersonType(v.getPersonType());
|
||||
welfareList.setUserState(v.getUserState());
|
||||
return welfareList;
|
||||
}).collect(Collectors.toList());
|
||||
insert(welfareLists);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Pagination pageData(WelfareListPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.loginname,
|
||||
t2.username,
|
||||
t2.sex,
|
||||
t2.birthday
|
||||
FROM
|
||||
`welfare_list` t1
|
||||
LEFT JOIN sys_user t2 ON t2.id = t1.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.projectId", "=", pageForm.getProjectId());
|
||||
if (StrUtil.isNotBlank(pageForm.getUserName())) {
|
||||
cnd.where().andLike("t2.username", pageForm.getUserName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
|
||||
cnd.where().andLike("t2.loginname", pageForm.getLoginName());
|
||||
}
|
||||
cnd.andEX("t2.sex", "=", pageForm.getSex());
|
||||
cnd.andEX("t2.birthday", "=", pageForm.getBirthday());
|
||||
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
|
||||
cnd.andEX("MONTH(t2.birthday)", "in", pageForm.getBirthMonths());
|
||||
}
|
||||
cnd.andEX("t1.welfareUnitId", "in", pageForm.getUnitIds());
|
||||
cnd.andEX("t1.welfareUnionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("t1.personType", "in", pageForm.getPersonTypes());
|
||||
cnd.andEX("t1.preparedBy", "in", pageForm.getPreparedBys());
|
||||
cnd.andEX("t1.userState", "in", pageForm.getUserStates());
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("t1.welfareUnionName");
|
||||
cnd.asc("t1.welfareUnitName");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination notWelfareUserPageData(WelfareFilterUserPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.personType,
|
||||
u.preparedBy,
|
||||
u.userState,
|
||||
u.unitId,
|
||||
u.unitName,
|
||||
u.unionId,
|
||||
u.unionName,
|
||||
u.member
|
||||
FROM
|
||||
vw_user u
|
||||
LEFT JOIN welfare_list w ON u.id = w.userId AND w.projectId = @projectId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("projectId", pageForm.getProjectId());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("w.userId", "is", null);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getUserName())) {
|
||||
cnd.where().andLike("u.username", pageForm.getUserName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
|
||||
cnd.where().andLike("u.loginname", pageForm.getLoginName());
|
||||
}
|
||||
cnd.andEX("u.sex", "=", pageForm.getSex());
|
||||
cnd.andEX("u.birthday", "=", pageForm.getBirthday());
|
||||
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
|
||||
cnd.andEX("MONTH(u.birthday)", "in", pageForm.getBirthMonths());
|
||||
}
|
||||
cnd.andEX("u.unionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("u.unitId", "in", pageForm.getUnitIds());
|
||||
cnd.andEX("u.personType", "in", pageForm.getPersonTypes());
|
||||
cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys());
|
||||
cnd.andEX("u.userState", "in", pageForm.getUserStates());
|
||||
cnd.andEX("u.member","=",pageForm.getIsMember());
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("u.unionCode");
|
||||
cnd.asc("u.unitCode");
|
||||
cnd.asc("u.sex");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWelfareUser(WelfareFilterUserPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
birthday,
|
||||
personType,
|
||||
preparedBy,
|
||||
userState,
|
||||
unitId,
|
||||
unitName,
|
||||
unionId,
|
||||
unionName,
|
||||
member
|
||||
FROM
|
||||
vw_user
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getUserName())) {
|
||||
cnd.where().andLike("username", pageForm.getUserName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
|
||||
cnd.where().andLike("loginname", pageForm.getLoginName());
|
||||
}
|
||||
cnd.andEX("sex", "=", pageForm.getSex());
|
||||
cnd.andEX("birthday", "=", pageForm.getBirthday());
|
||||
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
|
||||
cnd.andEX("MONTH(birthday)", "in", pageForm.getBirthMonths());
|
||||
}
|
||||
cnd.andEX("unionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("unitId", "in", pageForm.getUnitIds());
|
||||
cnd.andEX("personType", "in", pageForm.getPersonTypes());
|
||||
cnd.andEX("preparedBy", "in", pageForm.getPreparedBys());
|
||||
cnd.andEX("userState", "in", pageForm.getUserStates());
|
||||
cnd.andEX("member","=",pageForm.getIsMember());
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("unionCode");
|
||||
cnd.asc("unitCode");
|
||||
cnd.asc("sex");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
cnd.and("id", "not in", Sqls.create("select userId from `welfare_list` where projectId = @projectId").setParam("projectId", pageForm.getProjectId()));
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
// 插入到福利名单表中
|
||||
List<WelfareList> welfareList = list.stream().map(user -> {
|
||||
WelfareList wl = new WelfareList();
|
||||
wl.setProjectId(pageForm.getProjectId());
|
||||
wl.setUserId(user.getString("id"));
|
||||
wl.setWelfareUnitId(user.getString("unitId"));
|
||||
wl.setWelfareUnitName(user.getString("unitName"));
|
||||
wl.setWelfareUnionId(user.getString("unionId"));
|
||||
wl.setWelfareUnionName(user.getString("unionName"));
|
||||
wl.setPersonType(user.getString("personType"));
|
||||
wl.setPreparedBy(user.getString("preparedBy"));
|
||||
wl.setUserState(user.getString("userState"));
|
||||
return wl;
|
||||
}).toList();
|
||||
log.info("选择用户生成福利名单,筛选条件:{},筛选结果条数:{}", Json.toJson(pageForm), welfareList.size());
|
||||
dao().insert(welfareList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportXlsx(WelfareListPageForm pageForm, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.loginname,
|
||||
t2.username,
|
||||
t2.sex,
|
||||
DATE_FORMAT(t2.birthday, '%Y-%m-%d') AS birthday
|
||||
FROM
|
||||
`welfare_list` t1
|
||||
LEFT JOIN sys_user t2 ON t2.id = t1.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.projectId", "=", pageForm.getProjectId());
|
||||
if (StrUtil.isNotBlank(pageForm.getUserName())) {
|
||||
cnd.where().andLike("t2.username", pageForm.getUserName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
|
||||
cnd.where().andLike("t2.loginname", pageForm.getLoginName());
|
||||
}
|
||||
cnd.andEX("t2.sex", "=", pageForm.getSex());
|
||||
cnd.andEX("t2.birthday", "=", pageForm.getBirthday());
|
||||
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
|
||||
cnd.andEX("MONTH(t2.birthday)", "in", pageForm.getBirthMonths());
|
||||
}
|
||||
cnd.andEX("t1.welfareUnitId", "in", pageForm.getUnitIds());
|
||||
cnd.andEX("t1.welfareUnionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("t1.personType", "in", pageForm.getPersonTypes());
|
||||
cnd.andEX("t1.preparedBy", "in", pageForm.getPreparedBys());
|
||||
cnd.andEX("t1.userState", "in", pageForm.getUserStates());
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("t1.welfareUnionName");
|
||||
cnd.asc("t1.welfareUnitName");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entities.add(new ExcelExportEntity("出生日期", "birthday", 20));
|
||||
entities.add(new ExcelExportEntity("人员类型", "personType", 20));
|
||||
entities.add(new ExcelExportEntity("聘用方式", "preparedBy", 20));
|
||||
entities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
entities.add(new ExcelExportEntity("所属工会", "welfareUnionName", 20));
|
||||
entities.add(new ExcelExportEntity("所属单位", "welfareUnitName", 20));
|
||||
entities.add(new ExcelExportEntity("备注", "remark", 20));
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
// 导出Excel并下载
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list)) {
|
||||
CommonDownloadUtil.download("福利名单.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
log.error("导出Excel失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.budwk.app.zhgh.welfare.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListSummaryService;
|
||||
import org.nutz.dao.Dao;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareListSummaryServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/12 17:45
|
||||
*/
|
||||
public class WelfareListSummaryServiceImpl extends BaseServiceImpl implements WelfareListSummaryService {
|
||||
public WelfareListSummaryServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.budwk.app.zhgh.welfare.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProjectSubjectOption;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareProjectServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/12 17:38
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class WelfareProjectServiceImpl extends BaseServiceImpl<WelfareProject> implements WelfareProjectService {
|
||||
private static final Logger log = LoggerFactory.getLogger(WelfareProjectServiceImpl.class);
|
||||
|
||||
public WelfareProjectServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WelfareProject projectInfo(String projectId) {
|
||||
WelfareProject project = fetch(projectId);
|
||||
fetchLinks(project, "options",Cnd.NEW().asc("optionSort"));
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void saveProject(WelfareProject project) {
|
||||
// 插入项目
|
||||
project.setYear(DateUtil.thisYear());
|
||||
insertWith(project, "options");
|
||||
|
||||
// 更新首页活动
|
||||
Sys_home_activity sysHomeActivity = project.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void updateProject(WelfareProject project) {
|
||||
// 更新项目
|
||||
update(project);
|
||||
dao().clear(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", project.getId()));
|
||||
|
||||
// 新增或更新选项
|
||||
for (WelfareProjectSubjectOption option : project.getOptions()) {
|
||||
option.setWelfareId(project.getId());
|
||||
dao().insertOrUpdate(option);
|
||||
}
|
||||
|
||||
// 更新首页活动
|
||||
Sys_home_activity sysHomeActivity = project.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void deleteWelfare(String id) {
|
||||
dao().clear(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", id));
|
||||
dao().clear(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", id));
|
||||
dao().clear(WelfareList.class, Cnd.where(WelfareList::getProjectId, "=", id));
|
||||
delete(id);
|
||||
//删除首页活动
|
||||
dao().clear(Sys_home_activity.class, Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createList(String projectId, boolean created) {
|
||||
WelfareProject project = projectInfo(projectId);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
//如果是更新
|
||||
if (created) {
|
||||
Cnd cndMemberUser = Cnd.NEW();
|
||||
|
||||
List<String> userIds;
|
||||
|
||||
if (project.getIsYearBirthday() != null && project.getIsYearBirthday()) {
|
||||
//如果是生日福利
|
||||
//从user找出生日在今天之后的,并且不符合发放范围的人
|
||||
|
||||
cndMemberUser.and("DATE_FORMAT(birthday,'%m-%d')", ">=", DateUtil.format(new Date(), "MM-dd"));
|
||||
cndMemberUser.and("birthday", "is not", null);
|
||||
cndMemberUser.and(Cnd.exps("welfareMember", "=", 0).or("welfareMember", "is", null));
|
||||
|
||||
|
||||
List<Sys_user> welfareMember = dao().query(Sys_user.class, cndMemberUser);
|
||||
List<String> ids = welfareMember.stream().map(Sys_user::getId).collect(Collectors.toList());
|
||||
|
||||
//从本次福利里找出,生日在今天之后的,并且不是福利会员的人
|
||||
List<WelfareList> lists = dao().query(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "in", ids));
|
||||
userIds = lists.stream().map(WelfareList::getUserId).collect(Collectors.toList());
|
||||
|
||||
//加条件确保新入职的教职工加入到里面
|
||||
cnd.andEX("DATE_FORMAT(birthday,'%m-%d')", ">=", DateUtil.format(new Date(), "MM-dd"));
|
||||
|
||||
} else {
|
||||
|
||||
cndMemberUser.and(Cnd.exps("welfareMember", "=", 0).or("welfareMember", "is", null));
|
||||
|
||||
//从user找出不是福利会员的人,并且不符合发放范围的人
|
||||
List<Sys_user> welfareMember = dao().query(Sys_user.class, cndMemberUser);
|
||||
List<String> ids = welfareMember.stream().map(Sys_user::getId).collect(Collectors.toList());
|
||||
List<WelfareList> lists = dao().query(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "in", ids));
|
||||
userIds = lists.stream().map(WelfareList::getUserId).collect(Collectors.toList());
|
||||
|
||||
|
||||
List<WelfareList> welfareLists = dao().query(WelfareList.class, Cnd.where("projectId", "=", projectId));
|
||||
List<String> users = welfareLists.stream().map(WelfareList::getUserId).collect(Collectors.toList());
|
||||
cnd.andEX("id", "not in", users);
|
||||
}
|
||||
|
||||
|
||||
//删除在福利名单内,并且符合上面条件的人
|
||||
dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId).and("selectUserId", "in", userIds));
|
||||
dao().clear(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "in", userIds));
|
||||
|
||||
|
||||
} else {
|
||||
dao().clear(WelfareList.class, Cnd.where("projectId", "=", projectId));
|
||||
dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId));
|
||||
}
|
||||
|
||||
|
||||
Sql sql = Sqls.create("SELECT * from `vw_user` $condition");
|
||||
cnd.and("welfareMember", "=", 1);
|
||||
sql.setCondition(cnd);
|
||||
joinWelfareList(listMap(sql), projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WelfareProject> getWelfareList(Integer year) {
|
||||
List<WelfareProject> list = dao().query(WelfareProject.class, Cnd.NEW().andEX("year", "=", year).desc(WelfareProject::getChoiceTimeStart));
|
||||
for (WelfareProject project : list) {
|
||||
dao().fetchLinks(project, "options");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void joinWelfareList(List<NutMap> users, String projectId) {
|
||||
List<WelfareList> lists = new ArrayList<>();
|
||||
for (NutMap user : users) {
|
||||
WelfareList list = new WelfareList();
|
||||
list.setProjectId(projectId);
|
||||
list.setUserId(user.getString("id"));
|
||||
list.setWelfareUnitId(user.getString("unitId"));
|
||||
list.setWelfareUnitName(user.getString("unitName"));
|
||||
list.setWelfareUnionId(user.getString("unionId"));
|
||||
list.setWelfareUnionName(user.getString("unionName"));
|
||||
list.setPersonType(user.getString("personType"));
|
||||
list.setUserState(user.getString("userState"));
|
||||
lists.add(list);
|
||||
}
|
||||
dao().insert(lists);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
package com.budwk.app.zhgh.welfare.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<WelfareList> implements WelfareSelectionSituationService {
|
||||
public WelfareSelectionSituationServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(WelfareSelectionSituationPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.id,
|
||||
t1.projectId,
|
||||
t1.userId,
|
||||
t1.welfareUnionName,
|
||||
t1.welfareUnitName,
|
||||
t1.welfareUnitId,
|
||||
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
|
||||
GROUP_CONCAT(DISTINCT t2.mobile) AS mobile,
|
||||
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
|
||||
t4.username AS userName,
|
||||
t4.loginname AS loginName,
|
||||
t4.sex,
|
||||
t4.birthday
|
||||
FROM
|
||||
welfare_list t1
|
||||
LEFT JOIN welfare_project_user_selection t2 ON t2.welfareId = t1.projectId AND t2.selectUserId = t1.userId
|
||||
LEFT JOIN welfare_project_subject_option t3 ON t3.id = t2.selectOptionId
|
||||
LEFT JOIN sys_user t4 ON t4.id = t1.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_OPERATOR.name())) {
|
||||
cnd.and("t1.welfareUnionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
|
||||
cnd.and("t1.projectId", "=", pageForm.getProjectId());
|
||||
cnd.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId());
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getUserName())) {
|
||||
cnd.where().andLike("t4.username", pageForm.getUserName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
|
||||
cnd.where().andLike("t4.loginname", pageForm.getLoginName());
|
||||
}
|
||||
cnd.andEX("t1.welfareUnitId", "in", pageForm.getUnitIds());
|
||||
cnd.andEX("t1.welfareUnionId", "=", pageForm.getUnionId());
|
||||
|
||||
if (pageForm.getIsSelect() != null) {
|
||||
if (pageForm.getIsSelect()) {
|
||||
cnd.and("t2.id", "IS NOT", null);
|
||||
} else {
|
||||
cnd.and("t2.id", "IS", null);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("welfareUnionName");
|
||||
cnd.asc("welfareUnitName");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
cnd.groupBy("t1.id");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.id,
|
||||
t1.welfareUnionName,
|
||||
t1.welfareUnitName,
|
||||
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
|
||||
GROUP_CONCAT(DISTINCT t2.mobile) AS mobile,
|
||||
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
|
||||
t4.username AS userName,
|
||||
t4.loginname AS loginName,
|
||||
t4.sex
|
||||
FROM
|
||||
welfare_list t1
|
||||
LEFT JOIN welfare_project_user_selection t2 ON t2.welfareId = t1.projectId AND t2.selectUserId = t1.userId
|
||||
LEFT JOIN welfare_project_subject_option t3 ON t3.id = t2.selectOptionId
|
||||
LEFT JOIN sys_user t4 ON t4.id = t1.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_OPERATOR.name())) {
|
||||
cnd.and("t1.welfareUnionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
|
||||
cnd.and("t1.projectId", "=", pageForm.getProjectId());
|
||||
cnd.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId());
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getUserName())) {
|
||||
cnd.where().andLike("t4.username", pageForm.getUserName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
|
||||
cnd.where().andLike("t4.loginname", pageForm.getLoginName());
|
||||
}
|
||||
cnd.andEX("t1.welfareUnitId", "in", pageForm.getUnitIds());
|
||||
cnd.andEX("t1.welfareUnionId", "=", pageForm.getUnionId());
|
||||
|
||||
if (pageForm.getIsSelect() != null) {
|
||||
if (pageForm.getIsSelect()) {
|
||||
cnd.and("t2.id", "IS NOT", null);
|
||||
} else {
|
||||
cnd.and("t2.id", "IS", null);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("welfareUnionName");
|
||||
cnd.asc("welfareUnitName");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
cnd.groupBy("t1.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
// 项目
|
||||
WelfareProject project = dao().fetch(WelfareProject.class, pageForm.getProjectId());
|
||||
|
||||
|
||||
// excel列
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entities.add(new ExcelExportEntity("所属单位", "welfareUnitName", 20));
|
||||
entities.add(new ExcelExportEntity("所属工会", "welfareUnionName", 20));
|
||||
entities.add(new ExcelExportEntity("所选福利", "selectedOptions", 20));
|
||||
entities.add(new ExcelExportEntity("联系电话", "mobile", 20));
|
||||
|
||||
if(project.getProvideMode() == 3){
|
||||
entities.add(new ExcelExportEntity("收货地址", "receiveAddress", 40));
|
||||
}
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
// 导出Excel并下载
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list)) {
|
||||
CommonDownloadUtil.download("选择情况.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
log.error("导出Excel失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,420 @@
|
||||
package com.budwk.app.zhgh.welfare.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.mode.WelfareExportEntityTc;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareSingleService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName WelfareSingleServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/14 14:12
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class WelfareSingleServiceImpl extends BaseServiceImpl implements WelfareSingleService {
|
||||
public WelfareSingleServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap pageData(String projectId, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_WELFARE_ADMIN.name())) {
|
||||
cnd.and("id", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
cnd.andEX("id", "=", unionId);
|
||||
cnd.asc("unionCode");
|
||||
Sql sqlUnion = Sqls.create("select * from sys_union $condition");
|
||||
sqlUnion.setCondition(cnd);
|
||||
List<NutMap> sysUnions = listMap(sqlUnion);
|
||||
|
||||
Sql sqlViewList = Sqls.create("SELECT * FROM welfare_list where projectId=@projectId and welfareUnionId is not null").setParam("projectId", projectId);
|
||||
List<NutMap> viewMap = listMap(sqlViewList);
|
||||
|
||||
//循环每个分工会
|
||||
sysUnions.forEach(v -> {
|
||||
//找出这个分工会的人数
|
||||
List<NutMap> collect = viewMap.stream().filter(view -> view.getString("welfareUnionId").equals(v.getString("id"))).toList();
|
||||
v.addv("teacherSum", collect.size());
|
||||
});
|
||||
|
||||
|
||||
//选项数据
|
||||
List<NutMap> optionList = getOptionByProjectId(projectId);
|
||||
|
||||
//选择数据
|
||||
List<NutMap> userSelectionList = getUserSelectionByProjectId(projectId);
|
||||
for (NutMap wUnit : sysUnions) {
|
||||
//该分工会选择数据
|
||||
List<NutMap> thisUnionSelectionList;
|
||||
thisUnionSelectionList = userSelectionList.stream().filter(x -> x.getString("unionId").equals(wUnit.getString("id")) && x.getString("welfareId").equals(projectId)).toList();
|
||||
optionList.forEach(o -> {
|
||||
int count = 0;
|
||||
count = userSelectionList.stream().filter(x ->
|
||||
x.getString("unionId").equals(wUnit.getString("id")) &&
|
||||
x.getString("welfareId").equals(projectId) &&
|
||||
x.getString("selectOptionId").equals(o.getString("id"))).mapToInt(x -> x.getInt("selectNum")).sum();
|
||||
wUnit.put(o.getString("optionName"), count);
|
||||
});
|
||||
//已选人数
|
||||
wUnit.put("selectedNum", thisUnionSelectionList.stream().map(v -> v.getString("selectUserId")).distinct().count());
|
||||
//未选人数
|
||||
wUnit.put("unSelectedNum", wUnit.getInt("teacherSum") - wUnit.getInt("totalCount"));
|
||||
}
|
||||
|
||||
//表格列数据
|
||||
List<NutMap> labelList = new ArrayList<>();
|
||||
labelList.add(NutMap.NEW().addv("label", "本次福利会员人数").addv("prop", "teacherSum"));
|
||||
optionList.forEach(v -> {
|
||||
labelList.add(NutMap.NEW().addv("label", v.getString("optionName")).addv("prop", v.getString("optionName")));
|
||||
});
|
||||
labelList.add(NutMap.NEW().addv("label", "已选人数").addv("prop", "selectedNum"));
|
||||
labelList.add(NutMap.NEW().addv("label", "未选人数").addv("prop", "unSelectedNum"));
|
||||
|
||||
return NutMap.NEW().addv("tableList", sysUnions).addv("tableColumn", labelList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getOptionByProjectId(String projectId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wpso.id,
|
||||
wpso.optionName
|
||||
FROM
|
||||
welfare_project_subject_option wpso
|
||||
LEFT JOIN welfare_project_subject wps ON wps.id = wpso.subjectId
|
||||
WHERE
|
||||
wps.projectId = @projectId
|
||||
ORDER BY optionSort
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getUserSelectionByProjectId(String projectId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wl.welfareUnitId", "is not", null);
|
||||
cnd.andEX("wl.projectId", "=", projectId);
|
||||
|
||||
cnd.asc("wpus.selectUserId");
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wpus.selectOptionId,
|
||||
wpus.selectTime,
|
||||
wpus.userSign,
|
||||
wpus.selectNum,
|
||||
wpus.receiveAddress,
|
||||
wpus.welfareId,
|
||||
wpus.selectUserId,
|
||||
wl.welfareUnitId as unionId
|
||||
FROM
|
||||
`welfare_project_user_selection` wpus
|
||||
LEFT JOIN welfare_list wl on wl.userId = wpus.selectUserId AND wpus.welfareId = wl.projectId
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object receivePageData(String projectId, String unionId, Integer pageNumber, Integer pageSize) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
u.mobile,
|
||||
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName ,'(',wpus.selectNum,'份)') optionName,
|
||||
wpus.courierNumber
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
LEFT JOIN `vw_user` u ON u.id = wpus.selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||
$condition
|
||||
""").setParam("welfareId", projectId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
cnd.and("wpus.welfareId", "=", projectId);
|
||||
cnd.desc("u.loginname");
|
||||
cnd.desc("wpus.selectOptionId");
|
||||
sql.setCondition(cnd);
|
||||
if (Lang.isNotEmpty(pageNumber) && Lang.isNotEmpty(pageSize)) {
|
||||
return listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Workbook exportReceiveDetail(String projectId, String unionId) {
|
||||
|
||||
Sql optionSql = Sqls.create("""
|
||||
SELECT w2.id, w2.optionName
|
||||
FROM `welfare_project_subject` w1
|
||||
JOIN `welfare_project_subject_option` w2 ON w1.id = w2.subjectId
|
||||
WHERE w1.projectId = @projectId;
|
||||
""");
|
||||
optionSql.setParam("projectId", projectId);
|
||||
List<NutMap> options = (List<NutMap>) Daos.query(dao(), optionSql.toString(), Sqls.callback.maps());
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
us.loginname,
|
||||
us.username,
|
||||
wl.welfareUnitId unionid,
|
||||
un.name unionname,
|
||||
wpus.userSign,
|
||||
wpus.selectOptionId,
|
||||
wpus.selectNum
|
||||
FROM
|
||||
welfare_list wl
|
||||
LEFT JOIN sys_union un on un.id=wl.welfareUnitId
|
||||
LEFT JOIN sys_user us on us.id=wl.userId
|
||||
LEFT JOIN welfare_project_user_selection wpus ON wpus.selectUserId = wl.userId
|
||||
AND wpus.welfareId = @projectId
|
||||
WHERE
|
||||
wl.projectId = @projectId
|
||||
AND wl.welfareUnitId = @unionId
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
sql.setParam("unionId", unionId);
|
||||
List<NutMap> list = listMap(sql);
|
||||
list.forEach(l -> {
|
||||
if (StrUtil.isNotBlank(l.getString("userSign"))) {
|
||||
try {
|
||||
/* ByteArrayOutputStream signOs = new ByteArrayOutputStream();
|
||||
ftpService.download(l.getString("userSign"), signOs);
|
||||
byte[] imageBytes = signOs.toByteArray();
|
||||
if (Lang.isNotEmpty(imageBytes)) {
|
||||
l.setv("qzBytes", imageBytes);
|
||||
} else {
|
||||
l.setv("qzBytes", null);
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("序号", "no", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
for (NutMap option : options) {
|
||||
exportEntities.add(new ExcelExportEntity(option.getString("optionName"), option.getString("id"), 20));
|
||||
}
|
||||
ExcelExportEntity excelExportEntity = new ExcelExportEntity();
|
||||
excelExportEntity.setName("签字");
|
||||
excelExportEntity.setKey("qzBytes");
|
||||
excelExportEntity.setWidth(20);
|
||||
excelExportEntity.setType(2);
|
||||
excelExportEntity.setExportImageType(2);
|
||||
exportEntities.add(excelExportEntity);
|
||||
|
||||
List<String> loginnames = list.stream().map(v -> v.getString("loginname")).distinct().collect(Collectors.toList());
|
||||
|
||||
List<NutMap> dataList = loginnames.stream().map(v -> {
|
||||
NutMap data = NutMap.NEW();
|
||||
NutMap userMap = list.stream().filter(x -> x.getString("loginname").equals(v)).findFirst().get();
|
||||
data.put("username", userMap.getString("username"));
|
||||
data.put("qzBytes", userMap.get("qzBytes"));
|
||||
for (NutMap option : options) {
|
||||
if (StrUtil.isNotBlank(userMap.getString("selectOptionId"))) {
|
||||
NutMap selectOption = list.stream().filter(x -> x.getString("loginname").equals(v) && x.getString("selectOptionId").equals(option.getString("id"))).findFirst().orElse(null);
|
||||
if (Lang.isNotEmpty(selectOption)) {
|
||||
data.put(option.getString("id"), selectOption.getInt("selectNum"));
|
||||
} else {
|
||||
data.put(option.getString("id"), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}).collect(Collectors.toList());
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
dataList.get(i).put("no", i + 1);
|
||||
}
|
||||
|
||||
NutMap totalMap = NutMap.NEW();
|
||||
totalMap.put("no", "合计");
|
||||
for (NutMap option : options) {
|
||||
List<NutMap> selectOptionList = list.stream().filter(x -> StrUtil.isNotBlank(x.getString("selectOptionId")) && x.getString("selectOptionId").equals(option.getString("id"))).collect(Collectors.toList());
|
||||
int selectNum = selectOptionList.stream().mapToInt(s -> s.getInt("selectNum")).sum();
|
||||
totalMap.put(option.getString("id"), selectNum);
|
||||
}
|
||||
dataList.add(totalMap);
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, dataList);
|
||||
|
||||
return workbook;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object unclaimedData(String projectId, String unionId, Integer pageNumber, Integer pageSize) {
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
us.id,
|
||||
us.loginname loginName,
|
||||
us.username userName,
|
||||
it.name unitName,
|
||||
un.name unionName
|
||||
FROM
|
||||
welfare_list wl
|
||||
LEFT JOIN sys_union un ON un.id = wl.welfareUnitId
|
||||
LEFT JOIN sys_unit it ON it.id = wl.welfareSecondLevelUnitId
|
||||
LEFT JOIN sys_user us ON us.id = wl.userId
|
||||
WHERE
|
||||
projectId = @projectId
|
||||
AND userId NOT IN
|
||||
(
|
||||
SELECT selectUserId FROM welfare_project_user_selection WHERE welfareId = @projectId AND selectUserId IS NOT NULL
|
||||
)
|
||||
$modeCnd
|
||||
""");
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
sql.setVar("modeCnd", "AND welfareUnitId = '%s'".formatted(unionId));
|
||||
}
|
||||
sql.setParam("projectId", projectId);
|
||||
|
||||
if (Lang.isNotEmpty(pageNumber) && Lang.isNotEmpty(pageSize)) {
|
||||
return listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportReceiveDetailByUnionId(String projectId, String unionId, Boolean flag, HttpServletResponse response) {
|
||||
WelfareProject project = dao().fetch(WelfareProject.class, projectId);
|
||||
|
||||
List<NutMap> list;
|
||||
if (flag) {
|
||||
list = (List<NutMap>) receivePageData(projectId, unionId, null, null);
|
||||
} else {
|
||||
list = (List<NutMap>) unclaimedData(projectId, unionId, null, null);
|
||||
}
|
||||
|
||||
List<NutMap> list2 = list.stream().filter(v -> Strings.isNotBlank(v.getString("unionName"))).collect(Collectors.toList());
|
||||
|
||||
List<WelfareExportEntityTc> welfareExportEntityTcList = list2.stream()
|
||||
.map(map -> JSONUtil.toBean(Json.toJson(map), WelfareExportEntityTc.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
welfareExportEntityTcList.forEach(v -> {
|
||||
if (StrUtil.isNotBlank(v.getUserSign())) {
|
||||
ByteArrayOutputStream signOs = new ByteArrayOutputStream();
|
||||
// ftpService.download(v.getUserSign(), signOs);
|
||||
byte[] imageBytes = signOs.toByteArray();
|
||||
if (Lang.isNotEmpty(imageBytes)) {
|
||||
v.setQzBytes(imageBytes);
|
||||
} else {
|
||||
v.setQzBytes(null);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setSheetName(project.getName());
|
||||
try {
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, WelfareExportEntityTc.class, welfareExportEntityTcList);
|
||||
CommonDownloadUtil.download((project.getName() + (flag ? "已选名单" : "未选名单")) + ".xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportSummary(String projectId, String unionId, HttpServletResponse response) {
|
||||
|
||||
|
||||
NutMap dataMap = pageData(projectId, unionId);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
List<NutMap> labelList = dataMap.getAsList("tableColumn", NutMap.class);
|
||||
List<NutMap> list = dataMap.getAsList("tableList", NutMap.class);
|
||||
|
||||
NutMap map = NutMap.NEW().setv("name", "合计");
|
||||
labelList.forEach(o -> {
|
||||
List<Integer> numList = list.stream().map(v -> v.getInt(o.getString("prop"))).collect(Collectors.toList());
|
||||
int sum = numList.stream().mapToInt(Integer::intValue).sum();
|
||||
map.setv(o.getString("prop"), sum);
|
||||
});
|
||||
list.add(map);
|
||||
|
||||
labelList.add(0, NutMap.NEW().addv("label", "所属工会").addv("prop", "name"));
|
||||
labelList.forEach(v -> {
|
||||
entityList.add(new ExcelExportEntity(v.getString("label"), v.getString("prop"), 20));
|
||||
});
|
||||
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("汇总表", ""), entityList, list);
|
||||
CommonDownloadUtil.download("汇总表.xlsx", workbook, response);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doSelectByAdmin(String projectId, String welfareOptions) {
|
||||
List<NutMap> userList = (List<NutMap>) unclaimedData(projectId, null, null, null);
|
||||
List<String> userIds = userList.stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||
|
||||
List<NutMap> optionList = Json.fromJsonAsList(NutMap.class, welfareOptions);
|
||||
userIds.forEach(id -> {
|
||||
List<WelfareUserSelection> userSelections = optionList.stream().filter(v -> v.getInt("selectNum") > 0).map(v -> {
|
||||
WelfareUserSelection selection = new WelfareUserSelection();
|
||||
selection.setSelectTime(new Date());
|
||||
selection.setWelfareId(projectId);
|
||||
selection.setSelectUserId(id);
|
||||
selection.setSelectOptionId(v.getString("id"));
|
||||
selection.setReceiveAddress(null);
|
||||
selection.setSubjectId(v.getString("subjectId"));
|
||||
selection.setSelectNum(v.getInt("selectNum"));
|
||||
return selection;
|
||||
}).collect(Collectors.toList());
|
||||
dao().insert(userSelections);
|
||||
});
|
||||
dao().update(WelfareList.class,
|
||||
Chain.make("isReceive", true),
|
||||
Cnd.where("projectId", "=", projectId)
|
||||
.and("userId", "in", userIds));
|
||||
}
|
||||
|
||||
}
|
||||
+493
@@ -0,0 +1,493 @@
|
||||
package com.budwk.app.zhgh.welfare.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProjectSubjectOption;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject> implements WelfareStatisticsService {
|
||||
public WelfareStatisticsServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap pageData(String projectId, String unionId) {
|
||||
// 分工会数据
|
||||
List<Sys_union> unions = dao().query(Sys_union.class, Cnd.NEW().andEX(Sys_union::getId, "=", unionId).asc(Sys_union::getUnionCode));
|
||||
List<NutMap> mapUnions = BeanUtil.copyToList(unions, NutMap.class);
|
||||
|
||||
// 表格动态列数据
|
||||
List<NutMap> dynamicTableColumns = new ArrayList<>() {{
|
||||
add(NutMap.NEW().addv("label", "分工会").addv("prop", "name"));
|
||||
add(NutMap.NEW().addv("label", "本次福利会员人数").addv("prop", "teacherSum"));
|
||||
add(NutMap.NEW().addv("label", "已选人数").addv("prop", "selectedNum"));
|
||||
add(NutMap.NEW().addv("label", "未选人数").addv("prop", "unSelectedNum"));
|
||||
}};
|
||||
|
||||
// 选项数据
|
||||
List<WelfareProjectSubjectOption> welfareOptions = dao().query(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", projectId));
|
||||
|
||||
for (WelfareProjectSubjectOption welfareOption : welfareOptions) {
|
||||
dynamicTableColumns.add(NutMap.NEW().addv("label", welfareOption.getOptionName()).addv("prop", welfareOption.getId()));
|
||||
}
|
||||
|
||||
// 查询福利名单以及查询出选项数据
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.selectOptionId IS NOT NULL AS has_selected
|
||||
FROM
|
||||
`welfare_list` t1
|
||||
LEFT JOIN welfare_project_user_selection t2 ON t2.selectUserId = t1.userId
|
||||
AND t2.welfareId = t1.projectId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.projectId", "=", projectId);
|
||||
cnd.andEX("t1.welfareUnionId", "=", unionId);
|
||||
cnd.groupBy("t1.userId");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> welfareSelectionList = listMap(sql);
|
||||
|
||||
Sql sql2 = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.welfareUnionId
|
||||
FROM
|
||||
`welfare_project_user_selection` t1
|
||||
LEFT JOIN welfare_list t2 ON t2.projectId = t1.welfareId
|
||||
AND t1.selectUserId = t2.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd2 = Cnd.NEW();
|
||||
cnd2.and("t1.welfareId", "=", projectId);
|
||||
sql2.setCondition(cnd2);
|
||||
List<NutMap> userSelections = listMap(sql2);
|
||||
|
||||
for (NutMap union : mapUnions) {
|
||||
// 福利人数
|
||||
long teacherSum = welfareSelectionList.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId", "").equals(union.getString("id"))).count();
|
||||
union.put("teacherSum", teacherSum);
|
||||
|
||||
// 已选人数
|
||||
long selectedNum = welfareSelectionList.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId", "").equals(union.getString("id")) && v.getBoolean("has_selected")).count();
|
||||
union.put("selectedNum", selectedNum);
|
||||
|
||||
// 未选人数
|
||||
union.put("unSelectedNum", teacherSum - selectedNum);
|
||||
|
||||
// 各选项的选择人数
|
||||
for (WelfareProjectSubjectOption option : welfareOptions) {
|
||||
long count = userSelections.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId").equals(union.getString("id")) && StrUtil.isNotBlank(v.getString("selectOptionId")) && v.getString("selectOptionId").equals(option.getId())).map(v -> v.getString("selectUserId")).distinct().count();
|
||||
union.put(option.getId(), count);
|
||||
}
|
||||
}
|
||||
|
||||
return NutMap.NEW().addv("tableList", mapUnions).addv("tableColumn", dynamicTableColumns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination selectedUnionUserPageData(PageForm pageForm, String projectId, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
wl.userState,
|
||||
wl.personType,
|
||||
wl.preparedBy,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
u.postDoctoralJoinDate,
|
||||
DATE_FORMAT(u.birthday, '%Y-%m-%d') AS birthday,
|
||||
wpus.mobile,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName, '(', wpus.selectNum, '份)') selectOptionName
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
LEFT JOIN welfare_list wl on wl.userId = wpus.selectUserId AND wl.projectId = wpus.welfareId
|
||||
LEFT JOIN sys_user u ON u.id = wpus.selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wl.welfareUnionId", "=", unionId);
|
||||
cnd.and("wpus.welfareId", "=", projectId);
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("wl.welfareUnionName").desc("wl.welfareUnitName").desc("wpus.selectOptionId");
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.loginname", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.username", pageForm.getSearchKeyword());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportSelectedUnionUser(String projectId, String unionId, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
wl.userState,
|
||||
wl.personType,
|
||||
wl.preparedBy,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
u.postDoctoralJoinDate,
|
||||
DATE_FORMAT(u.birthday, '%Y-%m-%d') AS birthday,
|
||||
wpus.mobile,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName, '(', wpus.selectNum, '份)') selectOptionName
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
LEFT JOIN welfare_list wl on wl.userId = wpus.selectUserId AND wl.projectId = wpus.welfareId
|
||||
LEFT JOIN sys_user u ON u.id = wpus.selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wl.welfareUnionId", "=", unionId);
|
||||
cnd.and("wpus.welfareId", "=", projectId);
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("wl.welfareUnionName").desc("wl.welfareUnitName").desc("wpus.selectOptionId");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
// 项目名称
|
||||
Dao projectDao = Daos.ext(dao(), FieldFilter.create(WelfareProject.class, "name"));
|
||||
WelfareProject welfareProject = projectDao.fetch(WelfareProject.class, projectId);
|
||||
String projectName = welfareProject.getName();
|
||||
|
||||
// 分工会名称
|
||||
Sys_union union = dao().fetch(Sys_union.class, unionId);
|
||||
String unionName = Optional.ofNullable(union).map(Sys_union::getName).orElse("");
|
||||
|
||||
// excel列
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entities.add(new ExcelExportEntity("生日", "birthday", 20));
|
||||
entities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
entities.add(new ExcelExportEntity("教职工类别", "personType", 20));
|
||||
entities.add(new ExcelExportEntity("聘用方式", "preparedBy", 20));
|
||||
entities.add(new ExcelExportEntity("进站时间", "postDoctoralJoinDate", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "welfareUnitName", 20));
|
||||
entities.add(new ExcelExportEntity("工会", "welfareUnionName", 20));
|
||||
entities.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("所选福利", "selectOptionName", 20));
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
// 导出Excel并下载
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list)) {
|
||||
CommonDownloadUtil.download(projectName + unionName + "已选择人员.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
log.error("导出Excel失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination unSelectedUnionUserPageData(PageForm pageForm, String projectId, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
wl.userState,
|
||||
wl.personType,
|
||||
wl.preparedBy,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
u.postDoctoralJoinDate,
|
||||
DATE_FORMAT(u.birthday, '%Y-%m-%d') AS birthday
|
||||
FROM
|
||||
`welfare_list` wl
|
||||
LEFT JOIN welfare_project_user_selection wpus ON wl.userId = wpus.selectUserId
|
||||
AND wpus.welfareId = @projectId
|
||||
LEFT JOIN sys_user u ON u.id = wl.userId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wl.projectId", "=", projectId);
|
||||
cnd.and("wl.welfareUnionId", "=", unionId);
|
||||
cnd.and("wpus.selectOptionId", "is", null);
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("wl.welfareUnionName").desc("wl.welfareUnitName");
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.loginname", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.username", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportUnSelectedUnionUser(String projectId, String unionId, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
wl.userState,
|
||||
wl.personType,
|
||||
wl.preparedBy,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
u.postDoctoralJoinDate,
|
||||
DATE_FORMAT(u.birthday, '%Y-%m-%d') AS birthday
|
||||
FROM
|
||||
`welfare_list` wl
|
||||
LEFT JOIN welfare_project_user_selection wpus ON wl.userId = wpus.selectUserId
|
||||
AND wpus.welfareId = @projectId
|
||||
LEFT JOIN sys_user u ON u.id = wl.userId
|
||||
WHERE
|
||||
wl.projectId = @projectId
|
||||
AND wl.welfareUnionId = @unionId
|
||||
AND wpus.selectUserId IS NULL
|
||||
GROUP BY
|
||||
u.loginname
|
||||
ORDER BY
|
||||
wl.welfareUnionName DESC,
|
||||
wl.welfareUnitName DESC
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
sql.setParam("unionId", unionId);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
// 项目名称
|
||||
Dao projectDao = Daos.ext(dao(), FieldFilter.create(WelfareProject.class, "name"));
|
||||
WelfareProject welfareProject = projectDao.fetch(WelfareProject.class, projectId);
|
||||
String projectName = welfareProject.getName();
|
||||
|
||||
// 分工会名称
|
||||
Sys_union union = dao().fetch(Sys_union.class, unionId);
|
||||
String unionName = Optional.ofNullable(union).map(Sys_union::getName).orElse("");
|
||||
|
||||
// excel列
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "welfareUnitName", 20));
|
||||
entities.add(new ExcelExportEntity("工会", "welfareUnionName", 20));
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
// 导出Excel并下载
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list)) {
|
||||
CommonDownloadUtil.download(projectName + unionName + "未选择人员.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
log.error("导出Excel失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exportUnionExcel(String projectId, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
wpus.mobile,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName, '(', wpus.selectNum, '份)') selectOptionName
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
LEFT JOIN welfare_list wl on wl.userId = wpus.selectUserId AND wl.projectId = wpus.welfareId
|
||||
LEFT JOIN sys_user u ON u.id = wpus.selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wpus.welfareId", "=", projectId);
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("wl.welfareUnionName").desc("wl.welfareUnitName").desc("wpus.selectOptionId");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("分工会", "loginName", 20));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exportByWelfareOptions(String projectId, HttpServletResponse response) {
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("电话号码", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在分工会", "welfareUnionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在单位", "welfareUnitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在福利", "optionName", 50));
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
wpus.mobile,
|
||||
wpus.selectOptionId,
|
||||
wpso.optionName,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName, '(', wpus.selectNum, '份)') selectOptionName
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
LEFT JOIN welfare_list wl ON wl.userId = wpus.selectUserId
|
||||
AND wl.projectId = wpus.welfareId
|
||||
LEFT JOIN sys_user u ON u.id = wpus.selectUserId
|
||||
LEFT JOIN welfare_project_subject_option wpso ON wpso.id = wpus.selectOptionId
|
||||
WHERE
|
||||
wpus.welfareId = @projectId
|
||||
GROUP BY
|
||||
u.loginname
|
||||
ORDER BY
|
||||
wl.welfareUnionName DESC,
|
||||
wl.welfareUnitName DESC,
|
||||
wpus.selectOptionId DESC
|
||||
""");
|
||||
sql.setParam("projectId", projectId);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
|
||||
List<WelfareProjectSubjectOption> options = dao().query(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", projectId));
|
||||
for (WelfareProjectSubjectOption option : options) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(option.getOptionName() + "选择情况");
|
||||
exportParams.setSheetName(option.getOptionName());
|
||||
|
||||
List<NutMap> v = list.stream().filter(w -> w.getString("selectOptionId").equals(option.getId())).collect(Collectors.toList());
|
||||
service.createSheetForMap(workbook, exportParams, exportEntities, v);
|
||||
}
|
||||
|
||||
try {
|
||||
CommonDownloadUtil.download("按选项导出选择情况表.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
log.error("导出Excel失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exportSummary(String projectId, HttpServletResponse response) {
|
||||
// 分工会数据
|
||||
List<Sys_union> unions = dao().query(Sys_union.class, Cnd.NEW().asc(Sys_union::getUnionCode));
|
||||
List<NutMap> mapUnions = BeanUtil.copyToList(unions, NutMap.class);
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("分工会", "name", 20));
|
||||
entities.add(new ExcelExportEntity("本次福利会员人数", "teacherSum", 20));
|
||||
entities.add(new ExcelExportEntity("已选人数", "selectedNum", 20));
|
||||
entities.add(new ExcelExportEntity("未选人数", "unSelectedNum", 20));
|
||||
|
||||
// 选项数据
|
||||
List<WelfareProjectSubjectOption> welfareOptions = dao().query(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", projectId));
|
||||
for (WelfareProjectSubjectOption welfareOption : welfareOptions) {
|
||||
entities.add(new ExcelExportEntity(welfareOption.getOptionName(), welfareOption.getId(), 20));
|
||||
}
|
||||
|
||||
// 查询福利名单以及查询出选项数据
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.id IS NOT NULL AS has_selected
|
||||
FROM
|
||||
`welfare_list` t1
|
||||
LEFT JOIN welfare_project_user_selection t2 ON t2.selectUserId = t1.userId
|
||||
AND t2.welfareId = t1.projectId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.projectId", "=", projectId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> welfareSelectionList = listMap(sql);
|
||||
|
||||
Sql sql2 = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.welfareUnionId
|
||||
FROM
|
||||
`welfare_project_user_selection` t1
|
||||
LEFT JOIN welfare_list t2 ON t2.projectId = t1.welfareId
|
||||
AND t1.selectUserId = t2.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd2 = Cnd.NEW();
|
||||
cnd2.and("t1.welfareId", "=", projectId);
|
||||
sql2.setCondition(cnd2);
|
||||
List<NutMap> userSelections = listMap(sql2);
|
||||
|
||||
for (NutMap union : mapUnions) {
|
||||
// 福利人数
|
||||
long teacherSum = welfareSelectionList.stream().filter(v -> v.getString("welfareUnionId").equals(union.getString("id"))).count();
|
||||
union.put("teacherSum", teacherSum);
|
||||
|
||||
// 已选人数
|
||||
long selectedNum = welfareSelectionList.stream().filter(v -> v.getString("welfareUnionId").equals(union.getString("id")) && v.getBoolean("has_selected")).count();
|
||||
union.put("selectedNum", selectedNum);
|
||||
|
||||
// 未选人数
|
||||
union.put("unSelectedNum", teacherSum - selectedNum);
|
||||
|
||||
// 各选项的选择人数
|
||||
for (WelfareProjectSubjectOption option : welfareOptions) {
|
||||
long count = userSelections.stream().filter(v -> v.getString("welfareUnionId").equals(union.getString("id")) && v.getString("selectOptionId").equals(option.getId())).map(v -> v.getString("selectUserId")).distinct().count();
|
||||
union.put(option.getId(), count);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
// 导出Excel并下载
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, mapUnions)) {
|
||||
CommonDownloadUtil.download("汇总表.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
log.error("导出Excel失败", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.budwk.app.zhgh.welfare.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ExpressSelectUtil
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/5/8 17:39
|
||||
*/
|
||||
@IocBean
|
||||
@Slf4j
|
||||
public class ExpressSelectUtil {
|
||||
|
||||
//快递信息url
|
||||
private static final String URL = "https://eolink.o.apispace.com/wlgj1/paidtobuy_api/trace_search";
|
||||
//获取快递公司codeURL
|
||||
private static final String EXPRESS_COMPANY_URL = "https://eolink.o.apispace.com/wlgj1/paidtobuy_api/mail_discern";
|
||||
private static final String TOKEN = "vvzpibv7yzp2l89noyp8ut7tdjqqf1fq";
|
||||
|
||||
|
||||
public NutMap getExpressInfo(String mailNo, String tel) {
|
||||
|
||||
if (StrUtil.isBlank(mailNo) || StrUtil.isBlank(tel)) {
|
||||
// return Result.error("获取物流信息参数错误");
|
||||
throw new RuntimeException("获取物流信息参数错误");
|
||||
}
|
||||
|
||||
String expressCompanyCode = getExpressCompanyCode(mailNo);
|
||||
if (StrUtil.isBlank(expressCompanyCode)) {
|
||||
// return Result.error("获取物流公司代码失败");
|
||||
throw new RuntimeException("获取物流信息参数错误");
|
||||
}
|
||||
|
||||
NutMap map = new NutMap();
|
||||
map.setv("cpCode", expressCompanyCode);
|
||||
map.setv("mailNo", mailNo);
|
||||
map.setv("tel", tel);
|
||||
String body = HttpUtil.createPost(URL).header("X-APISpace-Token", TOKEN)
|
||||
.body(JSONUtil.toJsonStr(map))
|
||||
.execute().body();
|
||||
NutMap jsonBody = JSONUtil.toBean(body, NutMap.class);
|
||||
|
||||
if (jsonBody.getBoolean("success")) {
|
||||
NutMap logisticsTrace = jsonBody.getAs("logisticsTrace", NutMap.class);
|
||||
// return Result.success(logisticsTrace);
|
||||
return logisticsTrace;
|
||||
} else {
|
||||
//失败才返回
|
||||
// return Result.error(jsonBody.getString("msg"));
|
||||
throw new RuntimeException(jsonBody.getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getExpressCompanyCode(String mailNo) {
|
||||
NutMap map = new NutMap();
|
||||
map.setv("mailNo", mailNo);
|
||||
String body = HttpUtil.createPost(EXPRESS_COMPANY_URL).header("X-APISpace-Token", TOKEN)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(JSONUtil.toJsonStr(map))
|
||||
.execute().body();
|
||||
|
||||
NutMap jsonBody = JSONUtil.toBean(body, NutMap.class);
|
||||
if (jsonBody.getBoolean("success")) {
|
||||
List<NutMap> expressCompanyList = jsonBody.getAsList("expressCompanyList", NutMap.class);
|
||||
|
||||
NutMap expressCompany = expressCompanyList.get(0);
|
||||
return expressCompany.getString("cpCode");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user