积分管理
This commit is contained in:
@@ -120,6 +120,11 @@ public class Sys_user extends BaseModel implements Serializable {
|
||||
@DataCenterColumn(name = "学历", key = "zgxlmc")
|
||||
private String education;
|
||||
|
||||
@Column
|
||||
@Comment("婚姻状况")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String marriage;
|
||||
|
||||
@Column
|
||||
@Comment("学位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.budwk.app.zhgh.integral.constant;
|
||||
|
||||
import com.budwk.app.base.annotation.DictEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @ClassName IntegralOtherModelConstant
|
||||
* @Description 哪些类型可以获得积分
|
||||
* @Author zhf
|
||||
* @Date 2024/1/24 10:51
|
||||
*/
|
||||
@Getter
|
||||
@DictEnum(key = "IntegralOtherModelConstant", name = "哪些类型可以获得积分")
|
||||
@AllArgsConstructor
|
||||
public enum IntegralOtherModelConstant {
|
||||
PROPOSAL_DETERMINE("proposalDetermine", "写一条提案(立案)获得积分", false),
|
||||
PROPOSAL_OPINION("proposalOpinion", "写一条提案(作为意见)获得积分", false),
|
||||
TRAIN_SING_UP("trainSingUp", "参加品牌活动获得积分", false),
|
||||
ACTIVITY_SCHOOL("activitySchool", "参加体育活动获得积分", false),
|
||||
ACTIVITY_TISSUE("activityTissue", "参加文化活动获得积分", false),
|
||||
WMHD("wmhd", "参加教工作品征集获得积分", false),
|
||||
CAHD("cahd", "参加亲子作品征集获得积分", false),
|
||||
QUESTION("question", "填写问卷获得积分", false),
|
||||
FELLOWSHIP("fellowship", "参加单身联谊获得积分", false);
|
||||
|
||||
private final String otherModeCode;
|
||||
private final String otherModeName;
|
||||
private final Boolean disabled;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.budwk.app.zhgh.integral.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralConfig;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralInsertTaskOrSelectConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/7/14 10:24
|
||||
* @description 积分管理配置
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/integral/config")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api(tags = "积分基础设置")
|
||||
public class IntegralConfigController {
|
||||
|
||||
|
||||
@Inject
|
||||
private IntegralInsertTaskOrSelectConfigService integralInsertTaskOrSelectConfigService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/integral/config/index.html")
|
||||
@SaCheckPermission("integral.config")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("积分基础配置提交")
|
||||
@SaCheckPermission("integral.config")
|
||||
public Result submit(@Param("integralConfig") IntegralConfig integralConfig) {
|
||||
integralInsertTaskOrSelectConfigService.insertOrUpdate(integralConfig);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("积分基础配置查询")
|
||||
@SaCheckPermission("integral.config")
|
||||
public Result findOne() {
|
||||
IntegralConfig integralConfig = integralInsertTaskOrSelectConfigService.fetch(Cnd.NEW());
|
||||
return Result.success(integralConfig);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.budwk.app.zhgh.integral.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.constant.RoleConstant;
|
||||
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.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralDetailService;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralManageService;
|
||||
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.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/7/14 14:31
|
||||
* @description 扣减/增加积分明细
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/integral/detail")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api(tags = "积分明细")
|
||||
public class IntegralDetailController {
|
||||
|
||||
|
||||
@Inject
|
||||
private IntegralDetailService integralDetailService;
|
||||
|
||||
@Inject
|
||||
private IntegralManageService integralManageService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/integral/detail/index.html")
|
||||
@SaCheckPermission("integral.detail")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("integral.detail")
|
||||
public Result pageData(PageForm pageForm,
|
||||
String month,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String integralTime) {
|
||||
Sql sql = integralDetailService.getSql(pageForm.getPageOrderName(), pageForm.getPageOrderBy(), pageForm.getSearchKeyword(), month, unionId, unitId, integralTime);
|
||||
return Result.success(integralDetailService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除积分记录")
|
||||
@SaCheckPermission("integral.detail")
|
||||
@SLog(tag = "积分增扣明细", msg = "删除积分记录:${args[0]}")
|
||||
public Result doDelete(String id){
|
||||
integralDetailService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出年度积分详情")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public void exportIntegralDetail(String searchKeyword,
|
||||
String month,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String integralTime,
|
||||
boolean isZip, HttpServletResponse response) {
|
||||
Sql sql = integralDetailService.getSql(null, null, searchKeyword, month, unionId, unitId, integralTime);
|
||||
List<NutMap> list = integralDetailService.listMap(sql);
|
||||
List<Sys_union> unionList = integralDetailService.dao().query(Sys_union.class, Cnd.NEW());
|
||||
try {
|
||||
if (isZip) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode("积分详情.zip", "UTF-8"));
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
for (Sys_union union : unionList) {
|
||||
String fileName = union.getUnionCode() + union.getName().replaceAll("/", "、") + "积分详情表.xlsx";
|
||||
zipOutputStream.putNextEntry(new ZipEntry(fileName));
|
||||
List<NutMap> usersByUnion = list.stream().filter(v -> Strings.isNotBlank(v.getString("unionId")) && v.getString("unionId").equals(union.getId())).collect(Collectors.toList());
|
||||
Workbook workbook = integralManageService.exportIntegral(usersByUnion, false, zipOutputStream);
|
||||
workbook.write(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
}
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
} else {
|
||||
Workbook workbook = integralManageService.exportIntegral(list, false, response.getOutputStream());
|
||||
CommonDownloadUtil.download("积分详情表.xlsx", workbook, response);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
package com.budwk.app.zhgh.integral.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
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 com.budwk.app.base.constant.RoleConstant;
|
||||
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.base.utils.EasyExcelUtil;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
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.benefit.mode.BenefitUserTemp;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralDetail;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralManageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
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.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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.Strings;
|
||||
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 java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/integral/manage")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api(tags = "积分台账")
|
||||
public class IntegralManageController {
|
||||
|
||||
@Inject
|
||||
private IntegralManageService integralManageService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/integral/manage/index.html")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 首页查询
|
||||
* @param pageForm
|
||||
* @param year
|
||||
* @param unionId
|
||||
* @param unitId
|
||||
* @param personType
|
||||
* @param userState
|
||||
* @param integralTime
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public Result pageData(PageForm pageForm,
|
||||
String year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String personType,
|
||||
String userState,
|
||||
String integralTime) {
|
||||
Sql sql = integralManageService.getSql(pageForm.getPageOrderName(), pageForm.getPageOrderBy(), pageForm.getSearchKeyword(), year, unionId, unitId, personType, userState, integralTime);
|
||||
return Result.success(integralManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID查询积分详情
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param integralTime 获取积分时间
|
||||
* @return 积分详情分页列表
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("根据用户ID查询积分详情")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public Result getDetailByUserId(String userId,
|
||||
String month,
|
||||
String integralTime) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ind.id,
|
||||
ind.userId,
|
||||
ind.integral,
|
||||
ind.integralNotes,
|
||||
ind.integralTime,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex
|
||||
FROM
|
||||
integral_detail ind
|
||||
LEFT JOIN `vw_user` u ON ind.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("DATE_FORMAT(ind.`integralTime`,'%Y-%m')", "=", month);
|
||||
cnd.and("ind.userId", "=", userId);
|
||||
cnd.andEX("DATE(ind.integralTime)", "=", integralTime);
|
||||
cnd.desc("ind.integralTime");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(integralManageService.listMap(sql));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 扣减积分
|
||||
*
|
||||
* @param userIds 用户ID
|
||||
* @param integral 积分
|
||||
* @param integralNotes 积分说明
|
||||
* @return 扣减结果
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("根据userid扣减积分")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public Result doDeductions(@Param("userIds") String[] userIds,
|
||||
String integral, String integralNotes) {
|
||||
List<String> userIdList = Arrays.asList(userIds);
|
||||
List<View_user> userList = integralManageService.dao().query(View_user.class, Cnd.NEW().andEX(View_user::getId, "in", userIdList));
|
||||
if (Lang.isNotEmpty(userIdList)) {
|
||||
List<IntegralDetail> integralDetailList = new ArrayList<>();
|
||||
userIdList.forEach(v -> {
|
||||
View_user viewUser = userList.stream().filter(user -> user.getId().equals(v)).findFirst().orElse(null);
|
||||
IntegralDetail detail = new IntegralDetail();
|
||||
detail.setIntegral("-" + integral);
|
||||
detail.setIntegralNotes(integralNotes);
|
||||
detail.setYear(String.valueOf(DateUtil.thisYear()));
|
||||
detail.setUserId(v);
|
||||
detail.setUnionId(viewUser.getUnionId());
|
||||
detail.setUnitId(viewUser.getUnitId());
|
||||
detail.setUnionName(viewUser.getUnionName());
|
||||
detail.setUnitName(viewUser.getUnitName());
|
||||
detail.setIntegralTime(new Date());
|
||||
integralDetailList.add(detail);
|
||||
});
|
||||
integralManageService.insert(integralDetailList);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出积分汇总/分工会积分汇总压缩包
|
||||
*
|
||||
* @param searchKeyword 模糊查询值
|
||||
* @param year 年度
|
||||
* @param unionId 工会Id
|
||||
* @param unitId 单位Id
|
||||
* @param personType 人员类型
|
||||
* @param userState 在职状态
|
||||
* @param integralTime 获取积分时间
|
||||
* @param response response
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出积分汇总/分工会积分汇总压缩包")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public void exportIntegralSum(String searchKeyword,
|
||||
String year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String personType,
|
||||
String userState,
|
||||
String integralTime,
|
||||
boolean isZip, HttpServletResponse response) {
|
||||
Sql sql = integralManageService.getSql(null, null, searchKeyword, year, unionId, unitId, personType, userState, integralTime);
|
||||
List<NutMap> list = integralManageService.listMap(sql);
|
||||
List<Sys_union> unionList = integralManageService.dao().query(Sys_union.class, Cnd.NEW());
|
||||
try {
|
||||
if (isZip) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(year + "年度积分汇总.zip", "UTF-8"));
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
for (Sys_union union : unionList) {
|
||||
String fileName = union.getUnionCode() + union.getName().replaceAll("/", "、") + "积分汇总表.xlsx";
|
||||
zipOutputStream.putNextEntry(new ZipEntry(fileName));
|
||||
List<NutMap> usersByUnion = list.stream().filter(v -> Strings.isNotBlank(v.getString("unionid")) && v.getString("unionid").equals(union.getId())).collect(Collectors.toList());
|
||||
Workbook workbook = integralManageService.exportIntegral(usersByUnion, true, zipOutputStream);
|
||||
workbook.write(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
}
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
} else {
|
||||
Workbook workbook = integralManageService.exportIntegral(list, true, response.getOutputStream());
|
||||
CommonDownloadUtil.download("年度积分汇总表.xlsx", workbook, response);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("修改每条记录")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public Result doEdit(IntegralDetail detail) {
|
||||
integralManageService.updateIgnoreNull(detail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("根据id删除每条记录的信息")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public Result removeById(String id) {
|
||||
integralManageService.doDeleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("下载积分扣减导入模版")
|
||||
@SaCheckPermission("integral.manage")
|
||||
public void downloadImportTemp(HttpServletResponse response) {
|
||||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();) {
|
||||
EasyExcel.write(byteArrayOutputStream, IntegralTemp.class)
|
||||
.sheet("积分扣减导入模版")
|
||||
.doWrite(ArrayList::new);
|
||||
CommonDownloadUtil.download("积分扣减导入模版.xlsx", byteArrayOutputStream.toByteArray(), response);
|
||||
} catch (Exception e) {
|
||||
log.error("下载福利名单导入模版失败", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("下载福利名单导入模板")
|
||||
@SaCheckPermission("benefit.user")
|
||||
public void downloadImport(HttpServletResponse response) {
|
||||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();) {
|
||||
EasyExcel.write(byteArrayOutputStream, BenefitUserTemp.class)
|
||||
.sheet("福利名单导入模版")
|
||||
.doWrite(ArrayList::new);
|
||||
CommonDownloadUtil.download("福利名单导入模版.xlsx", byteArrayOutputStream.toByteArray(), response);
|
||||
} catch (Exception e) {
|
||||
log.error("下载福利名单导入模版失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("integral.manage")
|
||||
@ApiOperation("导入扣减积分名单")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Result doImport(TempFile file) {
|
||||
try {
|
||||
List<T> ts = EasyExcelUtil.syncReadModel(file.getFile(), IntegralTemp.class, 0, 1);
|
||||
List<IntegralTemp> integralTempList = JSONUtil.parseArray(JSONUtil.toJsonStr(ts)).toList(IntegralTemp.class);
|
||||
|
||||
List<String> loginNames = integralTempList.stream().map(IntegralTemp::getLoginName).toList();
|
||||
List<View_user> userList = integralManageService.dao().query(View_user.class, Cnd.NEW().andEX(View_user::getLoginname, "in", loginNames));
|
||||
Map<String, String> userMap = userList.stream().collect(Collectors.toMap(View_user::getLoginname, View_user::getId));
|
||||
|
||||
List<IntegralTemp> errorInfos = new ArrayList<>();
|
||||
List<IntegralDetail> insertInfos = new ArrayList<>();
|
||||
integralTempList.forEach(v -> {
|
||||
if (userMap.containsKey(v.getLoginName().trim())) {
|
||||
View_user viewUser = userList.stream().filter(user -> user.getLoginname().equals(v.getLoginName())).findFirst().orElse(null);
|
||||
IntegralDetail detail = new IntegralDetail();
|
||||
detail.setYear(String.valueOf(DateUtil.thisYear()));
|
||||
detail.setIntegral("-" + v.getIntegral());
|
||||
detail.setIntegralTime(v.getIntegralTime() == null ? new Date() : v.getIntegralTime());
|
||||
detail.setIntegralNotes(Strings.isNotBlank(v.getIntegralNotes()) ? v.getIntegralNotes() : "扣减导入");
|
||||
detail.setUserId(viewUser.getId());
|
||||
detail.setUnionId(viewUser.getUnionId());
|
||||
detail.setUnitId(viewUser.getUnitId());
|
||||
detail.setUnionName(viewUser.getUnionName());
|
||||
detail.setUnitName(viewUser.getUnitName());
|
||||
insertInfos.add(detail);
|
||||
} else {
|
||||
v.setResult("获取不到该用户信息,请检查工号是否正确!");
|
||||
errorInfos.add(v);
|
||||
}
|
||||
});
|
||||
|
||||
int successCount = Lang.isNotEmpty(insertInfos) ? integralManageService.insert(insertInfos).size() : 0;
|
||||
|
||||
if (Lang.isNotEmpty(errorInfos)) {
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("totalCount", integralTempList.size());
|
||||
nutMap.setv("successCount", successCount);
|
||||
nutMap.setv("errorCount", errorInfos.size());
|
||||
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||
return NutMap.NEW().addv("工号", v.getLoginName()).addv("姓名", v.getUserName()).addv("错误原因", v.getResult());
|
||||
}).collect(Collectors.toList()));
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@ContentRowHeight(20) // 内容行高
|
||||
@HeadRowHeight(20) // 表头行高
|
||||
@ColumnWidth(25)
|
||||
public static class IntegralTemp {
|
||||
|
||||
@ExcelProperty("工号")
|
||||
private String loginName;
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
private String userName;
|
||||
|
||||
@ExcelProperty("扣减积分")
|
||||
private String integral;
|
||||
|
||||
@ExcelProperty("扣减原因")
|
||||
private String integralNotes;
|
||||
|
||||
@ExcelProperty("扣减时间")
|
||||
private Date integralTime;
|
||||
|
||||
@ExcelIgnore
|
||||
private String result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.budwk.app.zhgh.integral.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.List;
|
||||
|
||||
/**
|
||||
* @ClassName IntegralConfig
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/1/19 15:32
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("integral_config")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("积分配置表")
|
||||
public class IntegralConfig extends BaseModel implements Serializable {
|
||||
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("ID")
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("每日签到积分")
|
||||
private Integer dailyAttendanceIntegral;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("个人活动报名积分")
|
||||
private Integer userApplyActivityIntegral;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("参加活动积分")
|
||||
private Integer attendActivityIntegral;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("几号几积分")
|
||||
private List<dayIntegral> dayIntegralList;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("荣誉等级积分")
|
||||
private List<honorLevel> honorLevelList;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("自定义其他模块积分")
|
||||
private List<otherModel> otherModelList;
|
||||
|
||||
@Data
|
||||
public static class dayIntegral {
|
||||
private String day;
|
||||
private String integral;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class honorLevel {
|
||||
private String id;
|
||||
private String name;
|
||||
private String integral;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class otherModel {
|
||||
private String otherModeCode;
|
||||
private Integer otherModeSort;
|
||||
private String otherModeName;
|
||||
private String integral;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.budwk.app.zhgh.integral.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("integral_detail")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("积分详情表")
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_USER_ID", fields = {"userId"}, unique = false),
|
||||
@Index(name = "INDEX_INTEGRAL", fields = {"integral"}, unique = false)
|
||||
})
|
||||
public class IntegralDetail extends BaseModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 4)
|
||||
@Comment("年度")
|
||||
private String year;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户单位id")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户单位")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户工会id")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户工会")
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Comment("积分")
|
||||
private String integral;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("积分来源备注")
|
||||
private String integralNotes;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("业务Id")
|
||||
private String bizId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("积分时间")
|
||||
private Date integralTime;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.integral.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralDetail;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
public interface IntegralDetailService extends BaseService<IntegralDetail> {
|
||||
|
||||
|
||||
|
||||
Sql getSql(String pageOrderName,
|
||||
String pageOrderBy,
|
||||
String searchKeyword,
|
||||
String month,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String integralTime);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.budwk.app.zhgh.integral.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralConfig;
|
||||
|
||||
public interface IntegralInsertTaskOrSelectConfigService extends BaseService<IntegralConfig> {
|
||||
|
||||
/**
|
||||
* @param otherModel
|
||||
* @return io.v.nutz.zhgh.integral.model.IntegralConfig.otherModel
|
||||
* @author zhf
|
||||
* @description 根据code查询自定义模块的积分
|
||||
*/
|
||||
IntegralConfig.otherModel findOneOtherModel(String otherModel);
|
||||
|
||||
/**
|
||||
* @param honorLevel
|
||||
* @return io.v.nutz.zhgh.integral.model.IntegralConfig.honorLevel
|
||||
* @author zhf
|
||||
* @description 根据评优评先的等级id查询积分
|
||||
*/
|
||||
IntegralConfig.honorLevel findOneHonorLevel(String honorLevel);
|
||||
|
||||
|
||||
IntegralConfig findOne();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.budwk.app.zhgh.integral.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralDetail;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
public interface IntegralManageService extends BaseService<IntegralDetail> {
|
||||
|
||||
|
||||
Workbook exportIntegral(List<NutMap> integralList, boolean isSum, OutputStream outputStream) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据业务Id删除
|
||||
*
|
||||
* @param bizId 业务Id
|
||||
* @return
|
||||
*/
|
||||
int doDeleteBYBizId(String bizId);
|
||||
|
||||
/**
|
||||
* 根据Id删除
|
||||
*
|
||||
* @param id Id
|
||||
* @return
|
||||
*/
|
||||
int doDeleteById(String id);
|
||||
|
||||
/**
|
||||
* @param userIds
|
||||
* @param bizId 业务id
|
||||
* @param integralNotes 备注
|
||||
* @param model IntegralOtherModelConstant里的otherModeCode
|
||||
* @author zhf
|
||||
* @description 自定义加积分除活动以外调用加积分
|
||||
*/
|
||||
void insertIntegralDetail(List<String> userIds, String bizId, String integralNotes, String model);
|
||||
|
||||
void insertIntegralDetail(String userId, String bizId, String integralNotes, String model);
|
||||
|
||||
void insertHonorLevelDetail(List<String> userIds, String bizId, String integralNotes, String honorLevelId);
|
||||
|
||||
|
||||
/**
|
||||
* 首页列表和导出使用
|
||||
* @param pageOrderName
|
||||
* @param pageOrderBy
|
||||
* @param searchKeyword
|
||||
* @param year
|
||||
* @param unionId
|
||||
* @param unitId
|
||||
* @param personType
|
||||
* @param userState
|
||||
* @param integralTime
|
||||
* @return
|
||||
*/
|
||||
Sql getSql(String pageOrderName,
|
||||
String pageOrderBy,
|
||||
String searchKeyword,
|
||||
String year,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String personType,
|
||||
String userState,
|
||||
String integralTime);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.budwk.app.zhgh.integral.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralDetail;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralDetailService;
|
||||
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.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/7/14 15:26
|
||||
* @description
|
||||
*/
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class IntegralDetailServiceImpl extends BaseServiceImpl<IntegralDetail> implements IntegralDetailService {
|
||||
public IntegralDetailServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql getSql(String pageOrderName,
|
||||
String pageOrderBy,
|
||||
String searchKeyword,
|
||||
String month,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String integralTime) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ind.id,
|
||||
ind.userId,
|
||||
ind.YEAR,
|
||||
ind.unionName,
|
||||
ind.unionId,
|
||||
ind.unitName,
|
||||
ind.unitId,
|
||||
ind.integral,
|
||||
ind.integralTime,
|
||||
ind.integralNotes,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.mobile,
|
||||
u.birthday
|
||||
FROM
|
||||
integral_detail ind
|
||||
LEFT JOIN `vw_user` u ON ind.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.username", searchKeyword);
|
||||
seg.orLike("u.loginname", searchKeyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (AuthUtil.hasRole("H04")) {
|
||||
cnd.and("ind.unionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
}
|
||||
cnd.andEX("DATE_FORMAT(ind.`integralTime`,'%Y-%m')", "=", month);
|
||||
cnd.andEX("ind.unionId", "=", unionId);
|
||||
cnd.andEX("ind.unionId", "=", unitId);
|
||||
cnd.andEX("DATE(ind.integralTime)", "=", integralTime);
|
||||
cnd.and("u.member", "=", 1);
|
||||
cnd.groupBy("u.id");
|
||||
|
||||
|
||||
if (StrUtil.isNotBlank(pageOrderName) && StrUtil.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, pageOrderBy.equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("ind.integralTime");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.budwk.app.zhgh.integral.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralConfig;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralInsertTaskOrSelectConfigService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/7/14 09:32
|
||||
* @description
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class IntegralInsertTaskOrSelectConfigServiceImpl extends BaseServiceImpl<IntegralConfig> implements IntegralInsertTaskOrSelectConfigService {
|
||||
public IntegralInsertTaskOrSelectConfigServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IntegralConfig.otherModel findOneOtherModel(String otherModel) {
|
||||
|
||||
IntegralConfig config = dao().fetch(IntegralConfig.class, Cnd.NEW());
|
||||
if (StrUtil.isNotBlank(otherModel)) {
|
||||
List<IntegralConfig.otherModel> otherModelList = config.getOtherModelList();
|
||||
IntegralConfig.otherModel otherModelClass = otherModelList.stream().filter(o -> o.getOtherModeCode().equals(otherModel)).findFirst().orElse(null);
|
||||
return otherModelClass;
|
||||
}
|
||||
return new IntegralConfig.otherModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegralConfig.honorLevel findOneHonorLevel(String honorLevel) {
|
||||
IntegralConfig config = dao().fetch(IntegralConfig.class, Cnd.NEW());
|
||||
if (StrUtil.isNotBlank(honorLevel)) {
|
||||
List<IntegralConfig.honorLevel> honorLevelList = config.getHonorLevelList();
|
||||
IntegralConfig.honorLevel honorLevelClass = honorLevelList.stream().filter(o -> o.getId().equals(honorLevel)).findFirst().orElse(null);
|
||||
return honorLevelClass;
|
||||
}
|
||||
return new IntegralConfig.honorLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegralConfig findOne() {
|
||||
return dao().fetch(IntegralConfig.class, Cnd.NEW());
|
||||
}
|
||||
}
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
package com.budwk.app.zhgh.integral.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.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
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.integral.model.IntegralConfig;
|
||||
import com.budwk.app.zhgh.integral.model.IntegralDetail;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralManageService;
|
||||
import com.budwk.app.zhgh.integral.service.IntegralInsertTaskOrSelectConfigService;
|
||||
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.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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 java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class IntegralManageServiceImpl extends BaseServiceImpl<IntegralDetail> implements IntegralManageService {
|
||||
public IntegralManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private IntegralInsertTaskOrSelectConfigService integralInsertOrSelectService;
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Override
|
||||
public Workbook exportIntegral(List<NutMap> integralList, boolean isSum, OutputStream outputStream) throws Exception {
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20));
|
||||
// exportEntities.add(new ExcelExportEntity("身份证号", "idcard", 30));
|
||||
exportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitName", 30));
|
||||
if (isSum) {
|
||||
exportEntities.add(new ExcelExportEntity("总积分", "sumIntegral", 20));
|
||||
} else {
|
||||
exportEntities.add(new ExcelExportEntity("积分", "integral", 20));
|
||||
exportEntities.add(new ExcelExportEntity("积分备注", "integralNotes", 30));
|
||||
exportEntities.add(new ExcelExportEntity("积分时间", "integralTime", 20));
|
||||
}
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setHeight((short) 10);
|
||||
return ExcelExportUtil.exportExcel(exportParams, exportEntities, integralList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据业务Id删除
|
||||
*
|
||||
* @param bizId 业务Id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int doDeleteBYBizId(String bizId) {
|
||||
return this.clear(Cnd.where("bizId", "=", bizId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据Id删除
|
||||
*
|
||||
* @param id Id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int doDeleteById(String id) {
|
||||
return this.clear(Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "Integral", tag = "积分管理", msg = "根据模式添加积分")
|
||||
public void insertIntegralDetail(List<String> userIds, String bizId, String integralNotes, String model) {
|
||||
//根据模式查询所得的积分
|
||||
IntegralConfig.otherModel oneOtherModel = integralInsertOrSelectService.findOneOtherModel(model);
|
||||
|
||||
if (Lang.isEmpty(oneOtherModel)) {
|
||||
return;
|
||||
}
|
||||
List<View_user> userList = dao().query(View_user.class, Cnd.NEW().andEX(View_user::getId, "in", userIds));
|
||||
List<IntegralDetail> integralDetails = new ArrayList<>();
|
||||
userIds.forEach(u -> {
|
||||
View_user viewUser = userList.stream().filter(user -> user.getId().equals(u)).findFirst().orElse(null);
|
||||
IntegralDetail detail = new IntegralDetail();
|
||||
detail.setIntegral(oneOtherModel.getIntegral());
|
||||
detail.setIntegralNotes(integralNotes);
|
||||
detail.setIntegralTime(DateUtil.date());
|
||||
detail.setYear(String.valueOf(DateUtil.thisYear()));
|
||||
detail.setUserId(u);
|
||||
detail.setUnionId(viewUser.getUnionId());
|
||||
detail.setUnitId(viewUser.getUnitId());
|
||||
detail.setUnionName(viewUser.getUnionName());
|
||||
detail.setUnitName(viewUser.getUnitName());
|
||||
detail.setBizId(bizId);
|
||||
integralDetails.add(detail);
|
||||
});
|
||||
if (Lang.isNotEmpty(userIds)) {
|
||||
integralInsertOrSelectService.insert(integralDetails);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertIntegralDetail(String userId, String bizId, String integralNotes, String model) {
|
||||
insertIntegralDetail(List.of(userId), bizId, integralNotes, model);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "Integral", tag = "积分管理", msg = "评优评先添加积分")
|
||||
public void insertHonorLevelDetail(List<String> userIds, String bizId, String integralNotes, String honorLevelId) {
|
||||
IntegralConfig.honorLevel oneHonorLevel = integralInsertOrSelectService.findOneHonorLevel(honorLevelId);
|
||||
if (Lang.isEmpty(oneHonorLevel) && StrUtil.isBlank(oneHonorLevel.getIntegral())) {
|
||||
return;
|
||||
}
|
||||
List<View_user> userList = dao().query(View_user.class, Cnd.where("id", "in", userIds));
|
||||
List<IntegralDetail> integralDetails = new ArrayList<>();
|
||||
userIds.forEach(u -> {
|
||||
View_user viewUser = userList.stream().filter(user -> user.getId().equals(u)).findFirst().orElse(null);
|
||||
IntegralDetail detail = new IntegralDetail();
|
||||
detail.setIntegral(oneHonorLevel.getIntegral());
|
||||
detail.setIntegralNotes(integralNotes);
|
||||
detail.setIntegralTime(DateUtil.date());
|
||||
detail.setYear(String.valueOf(DateUtil.thisYear()));
|
||||
detail.setUserId(u);
|
||||
detail.setUnionId(viewUser.getUnionId());
|
||||
detail.setUnitId(viewUser.getUnitId());
|
||||
detail.setUnionName(viewUser.getUnionName());
|
||||
detail.setUnitName(viewUser.getUnitName());
|
||||
detail.setBizId(bizId);
|
||||
integralDetails.add(detail);
|
||||
});
|
||||
if (Lang.isNotEmpty(userIds)) {
|
||||
integralInsertOrSelectService.insert(integralDetails);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql getSql(String pageOrderName, String pageOrderBy, String searchKeyword, String year, String unionId, String unitId, String personType, String userState, String integralTime) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ind.year,
|
||||
u.id userId,
|
||||
u.unionName,
|
||||
u.unionId,
|
||||
u.unitName,
|
||||
u.unitId,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.mobile,
|
||||
u.birthday,
|
||||
SUM( ind.integral ) AS sumIntegral
|
||||
FROM
|
||||
vw_user u
|
||||
LEFT JOIN integral_detail ind ON ind.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.username", searchKeyword);
|
||||
seg.orLike("u.loginname", searchKeyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (AuthUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
}
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
cnd.andEX("u.unionId", "=", unitId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("DATE(ind.integralTime)", "=", integralTime);
|
||||
cnd.and("u.member", "=", 1);
|
||||
cnd.groupBy("u.id");
|
||||
|
||||
|
||||
if (StrUtil.isNotBlank(pageOrderName) && StrUtil.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy("sumIntegral".equals(pageOrderName) ? "SUM( ind.integral )" : pageOrderName, pageOrderBy.equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("SUM( ind.integral )");
|
||||
cnd.asc("u.loginname");
|
||||
cnd.desc("ind.integralTime");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.el-form-item {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<template #header>
|
||||
<h3 style="color: #1867b0">积分基础配置</h3>
|
||||
</template>
|
||||
<div>
|
||||
<el-form :model="formData"
|
||||
:rules="formRules"
|
||||
class="applyForm"
|
||||
label-width="0"
|
||||
ref="form">
|
||||
<el-descriptions border class="descriptions-form">
|
||||
<el-descriptions-item label="每日签到积分">
|
||||
<el-form-item label-width="0"
|
||||
prop="dailyAttendanceIntegral">
|
||||
<el-input-number :min="0" placeholder="请填写每日签到积分" style="width: 100%"
|
||||
v-model="formData.dailyAttendanceIntegral"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="个人活动报名积分">
|
||||
<el-form-item label-width="0" prop="userApplyActivityIntegral">
|
||||
<el-input-number :min="0" placeholder="请填写个人活动报名积分"
|
||||
style="width: 100%"
|
||||
v-model="formData.userApplyActivityIntegral"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="参加活动积分">
|
||||
<el-form-item label-width="0"
|
||||
prop="attendActivityIntegral">
|
||||
<el-input-number :min="0" placeholder="请填写参加活动积分" style="width: 100%"
|
||||
v-model="formData.attendActivityIntegral"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item :span="3" label="评优评先等级积分">
|
||||
<el-table :data="formData.honorLevelList" border>
|
||||
<el-table-column label="等级名称" prop="day" width="365px">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
prop="name">
|
||||
<el-input maxlength="10" readonly
|
||||
v-model="row.name"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="积分" prop="integral">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
prop="integral">
|
||||
<el-input-number maxlength="10" :min="0"
|
||||
style="width: 100%"
|
||||
v-model="row.integral"></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item :span="3" label="自定义每月几号签到积分">
|
||||
<el-table :data="formData.dayIntegralList" border>
|
||||
<el-table-column label="几号" prop="day" width="365px">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
prop="day">
|
||||
<el-date-picker
|
||||
placeholder="选择日期"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
v-model="row.day"
|
||||
value-format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
<!-- <el-input-number maxlength="10" min="0"
|
||||
style="width: 100%"
|
||||
v-model="row.day"></el-input-number>-->
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="积分" prop="integral">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
prop="integral">
|
||||
<el-input-number maxlength="10" :min="0"
|
||||
style="width: 100%"
|
||||
v-model="row.integral"></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="150px">
|
||||
<template slot="header" scope="scope">
|
||||
<el-button @click="formData.dayIntegralList.push({})"
|
||||
size="mini"
|
||||
type="primary">
|
||||
增加记录
|
||||
</el-button>
|
||||
</template>
|
||||
<template scope="scope">
|
||||
<el-button
|
||||
@click="formData.dayIntegralList.splice(scope.$index,1)"
|
||||
icon="el-icon-delete" size="mini"
|
||||
type="danger"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item :span="3" label="自定义其他模块积分">
|
||||
<el-table :data="formData.otherModelList" border>
|
||||
<el-table-column label="模块" prop="day" width="365px">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
prop="day">
|
||||
<el-select @change="otherModeChange(row)"
|
||||
placeholder="请选择模块"
|
||||
style="width: 100%"
|
||||
v-model="row.otherModeCode">
|
||||
<el-option
|
||||
:disabled="item.disabled"
|
||||
:key="item.otherModeCode"
|
||||
:label="item.otherModeName"
|
||||
:value="item.otherModeCode"
|
||||
v-for="item in modelOptions">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="积分" prop="integral">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
prop="integral">
|
||||
<el-input-number maxlength="10" :min="0"
|
||||
style="width: 100%"
|
||||
v-model="row.integral"></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="150px">
|
||||
<template slot="header" scope="scope">
|
||||
<el-button @click="doOtherModel"
|
||||
size="mini"
|
||||
type="primary">
|
||||
增加记录
|
||||
</el-button>
|
||||
</template>
|
||||
<template scope="scope">
|
||||
<el-button
|
||||
@click="deleteOtherModel(scope)"
|
||||
icon="el-icon-delete" size="mini"
|
||||
type="danger"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
</el-descriptions>
|
||||
|
||||
<el-row align="center" justify="end" style="padding: 20px" type="flex">
|
||||
|
||||
<el-button @click="submit" type="primary">提交
|
||||
</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const honor_level_id = '3c1058afc91b4e69be46c585b1a48191'
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
dayIntegralList: [],
|
||||
honorLevelList: [],
|
||||
otherModelList: [],
|
||||
},
|
||||
modelOptions: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
otherModeChange(row) {
|
||||
const otherMode = this.modelOptions.find(m => m.otherModeCode === row.otherModeCode)
|
||||
row.otherModeName = otherMode.otherModeName
|
||||
this.modelOptions.map(m => {
|
||||
if (m.otherModeCode === row.otherModeCode) {
|
||||
m.disabled = true
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteOtherModel(scope) {
|
||||
this.formData.otherModelList.splice(scope.$index, 1)
|
||||
this.modelOptions.map(m => {
|
||||
if (m.otherModeCode === scope.row.otherModeCode) {
|
||||
m.disabled = false
|
||||
}
|
||||
})
|
||||
},
|
||||
doOtherModel() {
|
||||
this.formData.otherModelList.push({})
|
||||
const otherModes = this.formData.otherModelList.map(o => o.otherModeCode)
|
||||
this.modelOptions.map(m => m.disabled = otherModes.includes(m.otherModeCode))
|
||||
},
|
||||
async submit() {
|
||||
const resp = await $.post(loc() + '/submit', {
|
||||
integralConfig: JSON.stringify(this.formData)
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: resp.msg,
|
||||
type: 'success'
|
||||
});
|
||||
this.findOne()
|
||||
} else {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: resp.msg,
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
findOne() {
|
||||
$.post(loc() + '/findOne').then(res => {
|
||||
if (res.data) {
|
||||
this.formData = res.data
|
||||
}
|
||||
|
||||
if (!this.formData.dayIntegralList) {
|
||||
this.$set(this.formData, "dayIntegralList", [])
|
||||
}
|
||||
if (!this.formData.honorLevelList) {
|
||||
this.$set(this.formData, "honorLevelList", [])
|
||||
}
|
||||
if (!this.formData.otherModelList) {
|
||||
this.$set(this.formData, "otherModelList", [])
|
||||
} else {
|
||||
const otherModes = this.formData.otherModelList.map(o => o.otherModeCode)
|
||||
this.modelOptions.map(m => m.disabled = otherModes.includes(m.otherModeCode))
|
||||
}
|
||||
|
||||
if (!this.formData.honorLevelList) {
|
||||
this.getHonorLevelData()
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
async getHonorLevelData() {
|
||||
const res_data = await $.get('/platform/honor/basic/settings/getData', {parentId: honor_level_id})
|
||||
this.formData.honorLevelList = res_data.data
|
||||
},
|
||||
async getEnumOptions() {
|
||||
const resp = await this.$axios.post("/open/common/dictEnumOptions", { name: "IntegralOtherModelConstant" })
|
||||
if (resp.code === 0) {
|
||||
this.modelOptions = resp.data
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.getEnumOptions()
|
||||
this.findOne()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,220 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="年月">
|
||||
<el-date-picker
|
||||
@change="doSearch"
|
||||
placeholder="选择年月"
|
||||
style="width: 100%" type="month"
|
||||
v-model="pageForm.month"
|
||||
value-format="yyyy-MM">
|
||||
</el-date-picker>
|
||||
</search-item>
|
||||
<search-item label="积分日期">
|
||||
<el-date-picker
|
||||
@change="doSearch"
|
||||
placeholder="选择积分日期"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
v-model="pageForm.integralTime"
|
||||
value-format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
</search-item>
|
||||
<search-item label="姓名/工号">
|
||||
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"></el-input>
|
||||
</search-item>
|
||||
<search-item label="所属工会">
|
||||
<el-select
|
||||
@change="flushUnits"
|
||||
@clear="flushUnits"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="所属工会"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.unionId"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in unionList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属单位">
|
||||
<el-select clearable filterable placeholder="请选择" style="width: 100%"
|
||||
v-model="pageForm.unitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in unitList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool label="积分增扣列表">
|
||||
<el-button @click="exportIntegralDetail(false)" size="small" type="primary">
|
||||
导出积分详情表
|
||||
</el-button>
|
||||
<el-button @click="exportIntegralDetail(true)" size="small" type="primary">
|
||||
按分工会导出详情表
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData"
|
||||
:size="tableSize"
|
||||
@sort-change="pageOrder"
|
||||
ref="table"
|
||||
row-key="id"
|
||||
@sort-change="pageOrder"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
:index="indexMethod"
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
header-align="center"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="200px">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini" type="primary">查看
|
||||
</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-table>
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-diaLog :close-on-click-modal="false" :visible.sync="deductionsVisible" title="积分扣减详情"
|
||||
width="30%">
|
||||
|
||||
<el-form label-width="80px">
|
||||
<el-form-item label="扣减积分">
|
||||
{{viewData.integral}}
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="扣减原因">
|
||||
<div style="white-space: pre-line">{{viewData.integralNotes}}</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="text-align: right">
|
||||
<span>
|
||||
<el-button @click="deductionsVisible = false" type="primary">关 闭</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</el-diaLog>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
store,
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'loginname', label: '工号', sortable: true},
|
||||
{prop: 'username', label: '姓名', sortable: true},
|
||||
{prop: 'sex', label: '性别'},
|
||||
{prop: 'mobile', label: '联系电话'},
|
||||
{prop: 'unionName', label: '所属工会', sortable: true},
|
||||
{prop: 'unitName', label: '所属单位', sortable: true},
|
||||
{prop: 'integral', label: '积分', sortable: true},
|
||||
{prop: 'integralTime', label: '增扣时间', sortable: true},
|
||||
],
|
||||
pageForm: {
|
||||
month: moment().format('YYYY-MM'),
|
||||
integralTime: '',
|
||||
searchKeyword: '',
|
||||
unionId: '',
|
||||
unitId: '',
|
||||
},
|
||||
unionList: [],
|
||||
unitList: [],
|
||||
deductionsVisible: false,
|
||||
viewData: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
exportIntegralDetail(isZip) {
|
||||
const {
|
||||
year,
|
||||
integralTime,
|
||||
searchKeyword,
|
||||
unionId,
|
||||
unitId,
|
||||
personType,
|
||||
userState
|
||||
} = this.pageForm
|
||||
window.open(loc() + '/exportIntegralDetail?searchKeyword=' + searchKeyword + '&unionId=' + unionId + '&unitId=' + unitId +
|
||||
'&year=' + year + '&integralTime=' + integralTime + '&isZip=' + isZip )
|
||||
},
|
||||
doDelete(id) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.post(loc() + "/doDelete", {id}).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
openView(row) {
|
||||
this.viewData = row
|
||||
this.deductionsVisible = true
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.unitList = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.$businessTool.listUnion().then((data) => {
|
||||
this.unionList = data
|
||||
})
|
||||
this.$businessTool.listUnit().then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
this.pageData();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,451 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="年度">
|
||||
<el-date-picker
|
||||
@change="doSearch"
|
||||
placeholder="选择年度"
|
||||
style="width: 100%" type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</search-item>
|
||||
<search-item label="姓名/工号">
|
||||
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"></el-input>
|
||||
</search-item>
|
||||
<search-item label="所属工会">
|
||||
<el-select
|
||||
@change="flushUnits"
|
||||
@clear="flushUnits"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="所属工会"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.unionId"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in unionList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属单位">
|
||||
<el-select clearable filterable placeholder="请选择" style="width: 100%"
|
||||
v-model="pageForm.unitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in unitList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="在职状态">
|
||||
<dict-select v-model="pageForm.userState" placeholder="在职状态" @change="doSearch"
|
||||
code="USER_STATE"></dict-select>
|
||||
</search-item>
|
||||
<search-item label="人员类型">
|
||||
<dict-select v-model="pageForm.personType" placeholder="人员类型" @change="doSearch"
|
||||
code="PERSON_TYPE"></dict-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool label="积分列表">
|
||||
<el-button @click="batchDeductions()" size="small" type="primary">批量扣减
|
||||
</el-button>
|
||||
|
||||
<el-button @click="openImport" size="small" type="primary">扣减导入</el-button>
|
||||
<el-button @click="exportIntegralSum(false)" size="small" type="primary">
|
||||
导出积分汇总表
|
||||
</el-button>
|
||||
<el-button @click="exportIntegralSum(true)" size="small" type="primary">
|
||||
按分工会导出汇总表
|
||||
</el-button>
|
||||
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id"
|
||||
@selection-change="tableHandleSelectionChange"
|
||||
style="width: 100%">
|
||||
<el-table-column :reserve-selection="true" type="selection"></el-table-column>
|
||||
<el-table-column
|
||||
:index="indexMethod"
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
header-align="center"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="200px">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openView(row.userId)" size="mini" type="primary">查看
|
||||
</el-button>
|
||||
<el-button @click="doDeductions(row.userId)" size="mini" type="primary">
|
||||
扣减
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
<template #view>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年月:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
@change="doViewSearch"
|
||||
placeholder="选择年月"
|
||||
style="width: 100%" type="month"
|
||||
v-model="viewForm.month"
|
||||
value-format="yyyy-MM">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">积分日期:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
@change="doViewSearch"
|
||||
placeholder="选择积分日期"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
v-model="viewForm.integralTime"
|
||||
value-format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-query">
|
||||
<el-button @click="doViewSearch" icon="el-icon-search" type="primary">搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool label="积分详细信息">
|
||||
</table-tool>
|
||||
<el-table :data="viewData" :size="tableSize" @sort-change="pageOrder"
|
||||
class="vi-table"
|
||||
ref="viewTable"
|
||||
row-key="id" style="width: 100%" v-loading="tableLoading">
|
||||
<el-table-column type="index" width="80px">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in viewTableColumns"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" prop="online"
|
||||
width="180px">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑
|
||||
</el-button>
|
||||
<el-button @click="removeById(row.id)" size="mini" type="danger">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<file-import ref="viewImport" temp_url="/platform/integral/manage/downloadImportTemp"
|
||||
post_url="/platform/integral/manage/doImport" @flush="$refs.guava.index();pageData()"
|
||||
></file-import>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
|
||||
<el-diaLog :close-on-click-modal="false" :visible.sync="deductionsVisible" title="积分扣减"
|
||||
width="40%">
|
||||
|
||||
<el-form label-width="80px">
|
||||
<el-form-item label="扣减积分">
|
||||
<el-input placeholder="请输入要扣减的积分" style="width: 100%" type="number"
|
||||
v-model="deductionsData.integral"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="扣减原因">
|
||||
<el-input placeholder="请输入扣减原因" style="width: 100%" type="text"
|
||||
v-model="deductionsData.integralNotes"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="text-align: right">
|
||||
<span>
|
||||
<el-button @click="deductionsVisible = false">取 消</el-button>
|
||||
<el-button @click="doSubmit" type="primary">确 定</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</el-diaLog>
|
||||
|
||||
<el-diaLog :close-on-click-modal="false" :visible.sync="editVisible" title="积分编辑" width="40%">
|
||||
|
||||
<el-form label-width="80px">
|
||||
<el-form-item label="工号">
|
||||
<el-input readonly style="width: 100%" type="text"
|
||||
v-model="editData.loginname"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名">
|
||||
<el-input readonly style="width: 100%" type="text"
|
||||
v-model="editData.username"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="积分">
|
||||
<el-input placeholder="请输入要积分" style="width: 100%" type="number"
|
||||
v-model="editData.integral"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="积分备注">
|
||||
<el-input style="width: 100%" type="textarea" :rows="3"
|
||||
v-model="editData.integralNotes"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="积分时间">
|
||||
<el-input readonly style="width: 100%" type="text"
|
||||
v-model="editData.integralTime"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="text-align: right">
|
||||
<span>
|
||||
<el-button @click="editVisible = false">取 消</el-button>
|
||||
<el-button @click="doEdit" type="primary">确 定</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</el-diaLog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
store,
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'loginname', label: '工号', sortable: true},
|
||||
{prop: 'username', label: '姓名', sortable: true},
|
||||
{prop: 'sex', label: '性别'},
|
||||
{prop: 'mobile', label: '联系电话'},
|
||||
{prop: 'personType', label: '人员类型', sortable: true},
|
||||
{prop: 'userState', label: '在职状态', sortable: true},
|
||||
{prop: 'unionName', label: '所属工会', sortable: true},
|
||||
{prop: 'unitName', label: '所属单位', sortable: true},
|
||||
{prop: 'sumIntegral', label: '总积分', sortable: true},
|
||||
],
|
||||
viewTableColumns: [
|
||||
{prop: 'loginname', label: '工号', sortable: true},
|
||||
{prop: 'username', label: '姓名', sortable: true},
|
||||
{prop: 'sex', label: '性别'},
|
||||
{prop: 'integral', label: '积分'},
|
||||
{prop: 'integralNotes', label: '积分备注'},
|
||||
{prop: 'integralTime', label: '积分时间'},
|
||||
],
|
||||
pageForm: {
|
||||
year: moment().format('YYYY') + "",
|
||||
integralTime: '',
|
||||
searchKeyword: '',
|
||||
unionId: '',
|
||||
unitId: '',
|
||||
personType: '',
|
||||
userState: ''
|
||||
},
|
||||
unitList: [],
|
||||
unionList: [],
|
||||
deductionsVisible: false,
|
||||
editVisible: false,
|
||||
deductionsData: {},
|
||||
editData: {},
|
||||
checkUsers: [],
|
||||
viewForm: {
|
||||
userId: '',
|
||||
month: moment().format('YYYY-MM'),
|
||||
integralTime: ''
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"file-import": httpVueLoader("/components/plugins/sysImport/index.vue?v=" + new Date().getTime())
|
||||
},
|
||||
methods: {
|
||||
openImport() {
|
||||
this.$refs.guava.edit()
|
||||
this.$refs.viewImport.resetImportData()
|
||||
},
|
||||
openEdit(row) {
|
||||
this.editData = {}
|
||||
this.editData = {
|
||||
id: row.id,
|
||||
integral: row.integral,
|
||||
username: row.username,
|
||||
loginname: row.loginname,
|
||||
integralNotes: row.integralNotes,
|
||||
integralTime: row.integralTime,
|
||||
}
|
||||
this.editVisible = true
|
||||
},
|
||||
async doEdit() {
|
||||
const resp = await $.get(loc() + '/doEdit', this.editData)
|
||||
if (resp.code === 0) {
|
||||
this.editVisible = false
|
||||
this.notifySuccess(resp.msg)
|
||||
await this.getDetailByUserId()
|
||||
this.pageData();
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
},
|
||||
async removeById(id) {
|
||||
const confirm = await this.$confirm('您确定要删除此条记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if ('confirm' === confirm) {
|
||||
const resp = await $.get(loc() + '/removeById', {id: id})
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
await this.getDetailByUserId()
|
||||
this.pageData();
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
batchDeductions() {
|
||||
try {
|
||||
if (!this.checkUsers.length) {
|
||||
this.notifyWarning("请先勾选需要扣减的数据!!!")
|
||||
return
|
||||
}
|
||||
this.deductionsData = {
|
||||
userIds: [],
|
||||
integral: '',
|
||||
integralNotes: '',
|
||||
}
|
||||
const userIds = this.checkUsers.map(obj => obj.userId);
|
||||
this.deductionsData.userIds = JSON.stringify(userIds)
|
||||
this.deductionsVisible = true;
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
doDeductions(userId) {
|
||||
this.deductionsData = {
|
||||
userIds: [],
|
||||
integral: '',
|
||||
integralNotes: '',
|
||||
}
|
||||
this.checkUsers = []
|
||||
this.checkUsers.push(userId)
|
||||
this.deductionsData.userIds = JSON.stringify(this.checkUsers)
|
||||
this.deductionsVisible = true;
|
||||
},
|
||||
async doSubmit() {
|
||||
if (!this.deductionsData.integral && !this.deductionsData.integralNotes) {
|
||||
this.notifyWarning("请填写完整信息!!!")
|
||||
return;
|
||||
}
|
||||
const confirm = await this.$confirm('您确定要进行扣减吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
const resp = await $.post(loc() + '/doDeductions', this.deductionsData)
|
||||
if (resp.code === 0) {
|
||||
this.pageData()
|
||||
this.$refs.table.clearSelection();
|
||||
this.checkUsers = []
|
||||
this.notifySuccess(resp.msg)
|
||||
this.deductionsVisible = false
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
doViewSearch() {
|
||||
if (this.viewForm.integralTime) {
|
||||
this.viewForm.month = ''
|
||||
}
|
||||
this.getDetailByUserId();
|
||||
},
|
||||
async openView(userId) {
|
||||
this.viewForm.userId = userId
|
||||
await this.getDetailByUserId()
|
||||
this.$refs.guava.view()
|
||||
},
|
||||
async getDetailByUserId() {
|
||||
const resp = await $.post(loc() + '/getDetailByUserId', this.viewForm)
|
||||
if (resp.code === 0) {
|
||||
this.viewData = resp.data
|
||||
}
|
||||
},
|
||||
exportIntegralSum(isZip) {
|
||||
const {
|
||||
year,
|
||||
integralTime,
|
||||
searchKeyword,
|
||||
unionId,
|
||||
unitId,
|
||||
personType,
|
||||
userState
|
||||
} = this.pageForm
|
||||
window.open(loc() + '/exportIntegralSum?searchKeyword=' + searchKeyword + '&unionId=' + unionId + '&unitId=' + unitId +
|
||||
'&year=' + year + '&integralTime=' + integralTime + '&isZip=' + isZip +
|
||||
'&personType=' + personType + '&userState=' + userState)
|
||||
},
|
||||
|
||||
tableHandleSelectionChange(val) {
|
||||
this.checkUsers = val;
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.unitList = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
const isAdmin = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])
|
||||
if (isAdmin) {
|
||||
this.$businessTool.listUnion().then((data) => {
|
||||
this.unionList = data
|
||||
})
|
||||
this.$businessTool.listUnit().then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
} else {
|
||||
this.$businessTool.listUnion(this.$store.state.user.union.id).then((data) => {
|
||||
this.unionList = data
|
||||
})
|
||||
this.$businessTool.listUnit(this.$store.state.user.union.id).then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
}
|
||||
|
||||
this.pageData();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user