feat: 初始化

This commit is contained in:
2024-04-09 11:34:46 +08:00
commit 39f3acc15f
3209 changed files with 253442 additions and 0 deletions
@@ -0,0 +1,34 @@
package com.yida.data.form;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.annotation.MapperScans;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import cc.mrbird.febs.common.security.starter.annotation.EnableFebsCloudResourceServer;
/**
* @author wjm
*/
@SpringBootConfiguration
@EnableAsync
@EnableFeignClients(basePackages = "com.yida.data")
@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
@EnableFebsCloudResourceServer
@EnableAspectJAutoProxy(exposeProxy = true)
@MapperScan("com.yida.data.form.*.mapper")
public class EduCustomFormApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(EduCustomFormApplication.class)
.web(WebApplicationType.SERVLET)
.run(args);
}
}
@@ -0,0 +1,89 @@
package com.yida.data.form.apply.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormApprovalProcess;
import com.yida.data.customForm.dto.apply.ApplyFormSelectPageDTO;
import com.yida.data.customForm.dto.apply.SaveFormProcessDTO;
import com.yida.data.customForm.vo.apply.ApplyFormInfoVO;
import com.yida.data.customForm.vo.apply.ApplyFormProcessSelectVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import com.yida.data.form.apply.service.CoreApplyFormApprovalProcessService;
import com.yida.data.form.apply.service.CoreApplyFormService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 申请类表单管理 Controller
*
* @author ZYJ
* @date 2023/11/14
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/applyFrom")
@Api(tags = "后台--申请类表单管理")
public class CoreApplyFormController {
private final CoreApplyFormService coreApplyFormService;
private final CoreApplyFormApprovalProcessService coreApplyFormApprovalProcessService;
@ApiOperation("查询申请表单列表数据")
@PostMapping("/listApplyFormPage")
public ResultBean<IPage<ApplyFormSelectPageVO>> listApplyFormPage(ApplyFormSelectPageDTO dto) {
IPage<ApplyFormSelectPageVO> page = coreApplyFormService.listApplyFormPage(dto);
return ResultBean.buildSuccess(page);
}
@ApiOperation("查询申请表单详情")
@GetMapping("/getApplyFormInfo")
public ResultBean<ApplyFormInfoVO> getApplyFormInfo(
@RequestParam @ApiParam(value = "表单id", required = true) Long id) {
return ResultBean.buildSuccess(coreApplyFormService.getApplyFormInfo(id));
}
@ApiOperation("删除申请表单")
@GetMapping("/deleteApplyForm")
public ResultBean<String> deleteApplyForm(
@RequestParam @ApiParam(value = "表单id", required = true) Long id) {
coreApplyFormService.deleteApplyForm(id);
return ResultBean.buildSuccess();
}
@ApiOperation(value = "保存申请表单", consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/saveApplyForm", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultBean<Long> saveApplyForm(@RequestBody CoreApplyForm applyForm) {
return ResultBean.buildSuccess(coreApplyFormService.saveApplyForm(applyForm));
}
@ApiOperation("修改申请表单状态")
@GetMapping("updateEnableStatus")
public ResultBean<String> updateEnableStatus(
@ApiParam(value = "表单id", required = true) @RequestParam Long formId,
@ApiParam(value = "状态. 0为停用,1为启用", required = true) @RequestParam Integer enableStatus) {
coreApplyFormService.updateEnableStatus(formId, enableStatus);
return ResultBean.buildSuccess();
}
@ApiOperation("查询表单对应的审核流程数据")
@GetMapping("/listFormApprovalProcess")
public ResultBean<List<ApplyFormProcessSelectVO>> listFormApprovalProcess(
@ApiParam(value = "表单id", required = true) @RequestParam Long formId) {
return ResultBean.buildSuccess(coreApplyFormApprovalProcessService.listFormApprovalProcess(formId));
}
@ApiOperation("保存表单审核流程数据")
@PostMapping("/saveFormApprovalProcess")
public ResultBean<String> saveFormApprovalProcess(@RequestBody SaveFormProcessDTO dto) {
coreApplyFormApprovalProcessService.saveApplyFormApprovalProcess(dto.getFormId() , dto.getList());
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,37 @@
package com.yida.data.form.apply.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.customForm.dto.apply.ApplyFormFillSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormFillSelectPageVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import com.yida.data.form.apply.service.CoreApplyFormFillUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 表单填报管理 Controller
*
* @author ZYJ
* @date 2023/12/7
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/fill")
@Api(tags = "后台--表单填报管理")
public class CoreApplyFormFillController {
private final CoreApplyFormFillUserService coreApplyFormFillUserService;
@ApiOperation("查询申请表单填报列表数据")
@PostMapping("/listApplyFormFillPage")
public ResultBean<IPage<ApplyFormFillSelectPageVO>> listApplyFormFillPage(ApplyFormFillSelectPageDTO dto) {
IPage<ApplyFormFillSelectPageVO> page = coreApplyFormFillUserService.listApplyFormFillPage(dto);
return ResultBean.buildSuccess(page);
}
}
@@ -0,0 +1,71 @@
package com.yida.data.form.apply.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.form.apply.service.CoreApprovalProcessService;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.customForm.dto.apply.ApprovalProcessSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApprovalProcessInfoVO;
import com.yida.data.customForm.vo.apply.ApprovalProcessSelectPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 审核流程节点管理 Controller
*
* @author ZYJ
* @date 2023/11/21
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/process")
@Api(tags = "后台--审核流程管理")
public class CoreApprovalProcessController {
private final CoreApprovalProcessService coreApprovalProcessService;
@ApiOperation("查询审核流程节点列表数据")
@PostMapping("/listApprovalProcessPage")
public ResultBean<IPage<ApprovalProcessSelectPageVO>> listApprovalProcessPage(ApprovalProcessSelectPageDTO dto) {
IPage<ApprovalProcessSelectPageVO> page = coreApprovalProcessService.listApprovalProcessPage(dto);
return ResultBean.buildSuccess(page);
}
@ApiOperation("查询所有审核流程节点数据(排除当前表单包含的数据)")
@PostMapping("/listApprovalProcess")
public ResultBean<List<CoreApprovalProcess>> listApprovalProcess(
@ApiParam(value = "表单id", required = true) @RequestParam Long formId) {
return ResultBean.buildSuccess(coreApprovalProcessService.listApprovalProcess(formId));
}
@ApiOperation("查询审核流程节点详情")
@GetMapping("/getApprovalProcessInfo")
public ResultBean<ApprovalProcessInfoVO> getApprovalProcessInfo(
@RequestParam @ApiParam(value = "审核流程节点id", required = true) Long id) {
return ResultBean.buildSuccess(coreApprovalProcessService.getApprovalProcessInfo(id));
}
@ApiOperation("删除审核流程节点")
@GetMapping("/deleteApprovalProcess")
public ResultBean<String> deleteApprovalProcess(
@RequestParam @ApiParam(value = "审核流程节点id", required = true) Long id) {
coreApprovalProcessService.deleteApprovalProcess(id);
return ResultBean.buildSuccess();
}
@ApiOperation(value = "保存审核流程节点", consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/saveApprovalProcess", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultBean<String> saveApprovalProcess(@RequestBody CoreApprovalProcess process) {
coreApprovalProcessService.saveApprovalProcess(process);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,40 @@
package com.yida.data.form.apply.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.customForm.dto.apply.ApprovalRemindDTO;
import com.yida.data.customForm.vo.apply.ApprovalRemindInfoVO;
import com.yida.data.form.apply.service.CoreApprovalRemindService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
* 审核提醒策略 Controller
*
* @author ZYJ
* @date 2023/12/21
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/remind")
@Api(tags = "后台--审核提醒策略")
public class CoreApprovalRemindController {
private final CoreApprovalRemindService coreApprovalRemindService;
@ApiOperation("查询审核提醒策略详情")
@GetMapping("/getApprovalRemindInfo")
public ResultBean<ApprovalRemindInfoVO> getApprovalRemindInfo() {
return ResultBean.buildSuccess(coreApprovalRemindService.getApprovalRemindInfo());
}
@ApiOperation(value = "保存审核提醒策略", consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/saveApprovalRemind", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultBean<String> saveApprovalRemind(@RequestBody ApprovalRemindDTO dto) {
coreApprovalRemindService.saveApprovalRemind(dto);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,80 @@
package com.yida.data.form.apply.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.entity.applyForm.CoreOfficialSeal;
import com.yida.data.form.apply.service.CoreOfficialSealService;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.customForm.dto.apply.OfficialSealSaveDTO;
import com.yida.data.customForm.dto.apply.OfficialSealSelectPageDTO;
import com.yida.data.customForm.vo.apply.OfficialSealInfoVO;
import com.yida.data.customForm.vo.apply.OfficialSealSelectPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 学校公章管理 Controller
*
* @author ZYJ
* @date 2023/11/17
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/officialSeal")
@Api(tags = "后台--学校公章管理")
public class CoreOfficialSealController {
private final CoreOfficialSealService coreOfficialSealService;
@ApiOperation("查询学校公章列表数据")
@PostMapping("/listOfficialSealPage")
public ResultBean<IPage<OfficialSealSelectPageVO>> listOfficialSealPage(OfficialSealSelectPageDTO dto) {
IPage<OfficialSealSelectPageVO> page = coreOfficialSealService.listOfficialSealPage(dto);
return ResultBean.buildSuccess(page);
}
@ApiOperation("查询学校所有公章数据")
@PostMapping("/listOfficialSeal")
public ResultBean<List<CoreOfficialSeal>> listOfficialSeal(@RequestParam @ApiParam(value = "学校id") Long schoolId) {
return ResultBean.buildSuccess(coreOfficialSealService.list(Wrappers.lambdaQuery(new CoreOfficialSeal())
.eq(CoreOfficialSeal::getDeptId, schoolId)));
}
@ApiOperation("查询公章详情")
@GetMapping("/getOfficialSealInfo")
public ResultBean<OfficialSealInfoVO> getOfficialSealInfo(
@RequestParam @ApiParam(value = "公章id", required = true) Long id) {
return ResultBean.buildSuccess(coreOfficialSealService.getOfficialSealInfo(id));
}
@ApiOperation("删除公章")
@GetMapping("/deleteOfficialSeal")
public ResultBean<String> deleteOfficialSeal(
@RequestParam @ApiParam(value = "公章id", required = true) Long id) {
coreOfficialSealService.deleteOfficialSeal(id);
return ResultBean.buildSuccess();
}
@ApiOperation(value = "保存公章", consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/saveOfficialSeal", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultBean<String> saveOfficialSeal(@RequestBody OfficialSealSaveDTO dto) {
coreOfficialSealService.saveOfficialSeal(dto);
return ResultBean.buildSuccess();
}
@ApiOperation("修改公章状态")
@GetMapping("updateEnableStatus")
public ResultBean<String> updateEnableStatus(
@ApiParam(value = "公章id", required = true) @RequestParam Long id,
@ApiParam(value = "状态. 0为停用,1为启用", required = true) @RequestParam Integer enableStatus) {
coreOfficialSealService.updateEnableStatus(id, enableStatus);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,76 @@
package com.yida.data.form.apply.controller.app;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yida.data.form.apply.service.AppApplyFormService;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.customForm.dto.apply.*;
import com.yida.data.customForm.vo.apply.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* H5--申请类表单接口管理 Controller
*
* @author ZYJ
* @date 2023/11/14
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/app/applyFrom")
@Api(tags = "H5--申请类表单接口管理")
public class AppApplyFormController {
private final AppApplyFormService appApplyFormService;
@ApiOperation("家长端查询可填报的申请表单列表数据")
@PostMapping("/parent/listApplyFormPage")
public ResultBean<IPage<ApplyFormSelectPageVO>> listApplyFormPage(H5ApplyFormSelectPageDTO dto) {
IPage<ApplyFormSelectPageVO> page = appApplyFormService.listApplyFormPage(dto);
return ResultBean.buildSuccess(page);
}
@ApiOperation("家长端查询已经填报的申请数据")
@PostMapping("/parent/listMyApplyFormPage")
public ResultBean<IPage<MyApplyFormPageVO>> listMyApplyFormPage(H5ApplyFormSelectPageDTO dto) {
IPage<MyApplyFormPageVO> page = appApplyFormService.listMyApplyFormPage(dto);
return ResultBean.buildSuccess(page);
}
@ApiOperation("家长端查询申请表单详情")
@GetMapping("/parent/getApplyFormInfo")
public ResultBean<ApplyFormInfoVO> getApplyFormInfo(
@RequestParam @ApiParam(value = "表单id", required = true) Long id) {
return ResultBean.buildSuccess(appApplyFormService.getApplyFormInfo(id));
}
@ApiOperation("家长端提交保存申请表单数据")
@PostMapping("/parent/saveApplyFormData")
public ResultBean<String> saveApplyFormData(@RequestBody ApplyFormDataInputDTO dto) {
appApplyFormService.saveApplyFormData(dto);
return ResultBean.buildSuccess();
}
@ApiOperation("教师端我审批的申请表单")
@GetMapping("/staff/findApprovalApplyFormDataList")
public ResultBean<IPage<ApprovalApplyFormPageVO>> findApprovalApplyFormDataList(SelectApprovalApplyFormDataListDTO dto) {
IPage<ApprovalApplyFormPageVO> page = appApplyFormService.findApprovalApplyFormDataList(dto);
return ResultBean.buildSuccess(page);
}
@ApiOperation("获取申请表单填报数据")
@PostMapping("/getApplyFormFillUserData")
public ResultBean<ApplyFormFillUserDataVO> getApplyFormFillUserData(ApplyFormFillUserDataDTO dto) {
return ResultBean.buildSuccess(appApplyFormService.getApplyFormFillUserData(dto));
}
@ApiOperation("教师端填报数据审核")
@PostMapping("/staff/auditForm")
public ResultBean<String> auditForm(@RequestBody AuditFormDTO dto) {
appApplyFormService.auditForm(dto);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,12 @@
package com.yida.data.form.apply.mapper;
/**
* H5--申请类表单管理 mapper
*
* @author ZYJ
* @date 2023/11/28
*/
public interface AppApplyFormMapper {
}
@@ -0,0 +1,48 @@
package com.yida.data.form.apply.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 申请类表单填报数据 mapper
*
* @author ZYJ
* @date 2023/11/16
*/
public interface ApplyFormDataMapper {
/**
* 查询数据表字段
*
* @param tableName 表名称
* @return java.util.List<java.lang.String>
* @author ZYJ
* @date 2023/11/16 17:19
*/
List<String> findApplyFormFiled(@Param("tableName") String tableName);
/**
* 动态保存sql,并返回主键id
*
* @param sql 对应sql语句
* @param parameterMap 参数
* @author ZYJ
* @date 2023/11/16 17:34
*/
void saveFormData(@Param("sql") String sql,
@Param("parameterMap") Map<String, Object> parameterMap);
/**
* 查询用户填报数据信息
*
* @param sql 对应sql语句
* @param parameterMap 参数
* @return java.util.Map
* @author ZYJ
* @date 2023/11/29 15:28
*/
Map findFillUserData(@Param("sql") String sql,
@Param("parameterMap") Map<String, Object> parameterMap);
}
@@ -0,0 +1,43 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormApprovalProcess;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.customForm.dto.apply.ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormProcessSelectVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 申请表单对应的审核流程 mapper
*
* @author ZYJ
* @date 2023/11/21
*/
public interface CoreApplyFormApprovalProcessMapper extends BaseMapper<CoreApplyFormApprovalProcess> {
/**
* 查询表单对应的审核流程
*
* @param applyFormId 表单id
* @return java.util.List<com.yida.data.common.core.entity.applyForm.CoreApprovalProcess>
* @author ZYJ
* @date 2023/11/24 14:04
*/
List<CoreApprovalProcess> selectApplyFormApprovalProcess(@Param("applyFormId") Long applyFormId);
/**
* 查询表单对应的审核流程页面数据
*
* @param formId 表单id
* @return java.util.List<com.yida.data.customForm.vo.apply.ApplyFormProcessSelectVO>
* @author ZYJ
* @date 2023/12/18 16:51
*/
List<ApplyFormProcessSelectVO> listFormApprovalProcess(@Param("formId") Long formId);
}
@@ -0,0 +1,15 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUserApprovalProcess;
/**
* 表单填报用户对应审核流程表 mapper
*
* @author ZYJ
* @date 2023/11/24
*/
public interface CoreApplyFormFillUserApprovalProcessMapper extends BaseMapper<CoreApplyFormFillUserApprovalProcess> {
}
@@ -0,0 +1,15 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUserApprovalProcessRecord;
/**
* 填报用户表单审核流程记录表(具体的审核信息) mapper
*
* @author ZYJ
* @date 2023/11/24
*/
public interface CoreApplyFormFillUserApprovalProcessRecordMapper extends BaseMapper<CoreApplyFormFillUserApprovalProcessRecord> {
}
@@ -0,0 +1,78 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUser;
import com.yida.data.customForm.dto.apply.ApplyFormFillSelectPageDTO;
import com.yida.data.customForm.dto.apply.ApprovalFillUserFormPageDTO;
import com.yida.data.customForm.dto.apply.H5ApplyFormSelectPageDTO;
import com.yida.data.customForm.dto.apply.SelectApprovalApplyFormDataListDTO;
import com.yida.data.customForm.vo.apply.ApplyFormFillSelectPageVO;
import com.yida.data.customForm.vo.apply.ApprovalApplyFormPageVO;
import com.yida.data.customForm.vo.apply.MyApplyFormPageVO;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
/**
* 申请表单填报用户信息表 mapper
*
* @author ZYJ
* @date 2023/11/22
*/
public interface CoreApplyFormFillUserMapper extends BaseMapper<CoreApplyFormFillUser> {
/**
* 查询用户已经填报的数据
*
* @param page 分页信息
* @param dto 查询参数
* @param userIds 填报用户id集合
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.MyApplyFormPageVO>
* @author ZYJ
* @date 2023/11/23 15:06
*/
IPage<MyApplyFormPageVO> selectUserFillForm(Page<CoreApplyForm> page,
@Param("dto") H5ApplyFormSelectPageDTO dto,
@Param("userIds") List<Long> userIds);
/**
* 职工参与审核的填报用户信息
*
* @param dto 查询条件
* @param dateTime 时间点
* @return java.util.List<com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUser>
* @author ZYJ
* @date 2023/11/29 10:36
*/
List<CoreApplyFormFillUser> findApprovalFormDataFillUserList(@Param("dto") SelectApprovalApplyFormDataListDTO dto,
@Param("dateTime") LocalDateTime dateTime);
/**
* 查询教师审核的表单分页数据
*
* @param page 分页信息
* @param dto 查询条件
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApprovalApplyFormPageVO>
* @author ZYJ
* @date 2023/11/29 13:51
*/
IPage<ApprovalApplyFormPageVO> selectApprovalUserFillForm(Page page,
@Param("dto") ApprovalFillUserFormPageDTO dto);
/**
* 查询申请表单填报列表数据
*
* @param page 分页信息
* @param dto 查询条件
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApplyFormFillSelectPageVO>
* @author ZYJ
* @date 2023/12/7 15:19
*/
IPage<ApplyFormFillSelectPageVO> listApplyFormFillPage(Page<CoreApplyFormFillUser> page,
@Param("dto") ApplyFormFillSelectPageDTO dto);
}
@@ -0,0 +1,14 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormItemChildren;
/**
* 申请类型表单组件选项 mapper
*
* @author ZYJ
* @date 2023/11/14
*/
public interface CoreApplyFormItemChildrenMapper extends BaseMapper<CoreApplyFormItemChildren> {
}
@@ -0,0 +1,15 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormItem;
import com.yida.data.common.core.entity.customform.CoreCustomFormItems;
/**
* 申请类型表单组件 mapper
*
* @author ZYJ
* @date 2023/11/14
*/
public interface CoreApplyFormItemMapper extends BaseMapper<CoreApplyFormItem> {
}
@@ -0,0 +1,49 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.customForm.dto.apply.ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import org.apache.ibatis.annotations.Param;
/**
* 申请类型表单 mapper
*
* @author ZYJ
* @date 2023/11/14
*/
public interface CoreApplyFormMapper extends BaseMapper<CoreApplyForm> {
/**
* 查询申请表单列表数据
*
* @param page 分页信息
* @param dto 查询参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO>
* @author ZYJ
* @date 2023/11/14 16:17
*/
IPage<ApplyFormSelectPageVO> listApplyFormPage(Page<CoreApplyForm> page,
@Param("dto") ApplyFormSelectPageDTO dto);
/**
* 返回int类型数据的动态sql
*
* @param sql 对应sql语句
* @return java.lang.Integer
* @author ZYJ
* @date 2023/11/14 16:52
*/
Integer initSqlReturnInt(@Param("sql") String sql);
/**
* 没有返回值的动态sql
*
* @param sql 对应sql语句
* @author ZYJ
* @date 2023/11/15 15:19
*/
void initSqlReturnVoid(@Param("sql") String sql);
}
@@ -0,0 +1,30 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.customForm.dto.apply.ApprovalProcessSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApprovalProcessSelectPageVO;
import org.apache.ibatis.annotations.Param;
/**
* 审核流程表 mapper
*
* @author ZYJ
* @date 2023/11/21
*/
public interface CoreApprovalProcessMapper extends BaseMapper<CoreApprovalProcess> {
/**
* 查询审核流程节点列表数据
*
* @param page 分页信息
* @param dto 查询参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApprovalProcessSelectPageVO>
* @author ZYJ
* @date 2023/11/21 15:31
*/
IPage<ApprovalProcessSelectPageVO> listApprovalProcessPage(Page<CoreApprovalProcess> page,
@Param("dto") ApprovalProcessSelectPageDTO dto);
}
@@ -0,0 +1,15 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcessUser;
/**
* 审核流程人员配置表 mapper
*
* @author ZYJ
* @date 2023/11/21
*/
public interface CoreApprovalProcessUserMapper extends BaseMapper<CoreApprovalProcessUser> {
}
@@ -0,0 +1,21 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.common.core.entity.applyForm.CoreApprovalRemind;
import com.yida.data.customForm.dto.apply.ApprovalProcessSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApprovalProcessSelectPageVO;
import org.apache.ibatis.annotations.Param;
/**
* 审核提醒策略表 mapper
*
* @author ZYJ
* @date 2023/11/21
*/
public interface CoreApprovalRemindMapper extends BaseMapper<CoreApprovalRemind> {
}
@@ -0,0 +1,33 @@
package com.yida.data.form.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.common.core.entity.applyForm.CoreOfficialSeal;
import com.yida.data.customForm.dto.apply.ApplyFormSelectPageDTO;
import com.yida.data.customForm.dto.apply.OfficialSealSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import com.yida.data.customForm.vo.apply.OfficialSealSelectPageVO;
import org.apache.ibatis.annotations.Param;
/**
* 学校公章 mapper
*
* @author ZYJ
* @date 2023/11/17
*/
public interface CoreOfficialSealMapper extends BaseMapper<CoreOfficialSeal> {
/**
* 查询学校公章列表数据
*
* @param page 分页信息
* @param dto 查询条件
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.OfficialSealSelectPageVO>
* @author ZYJ
* @date 2023/11/17 15:45
*/
IPage<OfficialSealSelectPageVO> listOfficialSealPage(Page<CoreOfficialSeal> page,
@Param("dto") OfficialSealSelectPageDTO dto);
}
@@ -0,0 +1,85 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yida.data.customForm.dto.apply.*;
import com.yida.data.customForm.vo.apply.*;
import java.util.List;
/**
* H5--申请类表单管理 Service
*
* @author ZYJ
* @date 2023/11/15
*/
public interface AppApplyFormService {
/**
* 家长端查询申请表单列表数据
*
* @param dto 查询条件
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO>
* @author ZYJ
* @date 2023/11/15 20:51
*/
IPage<ApplyFormSelectPageVO> listApplyFormPage(H5ApplyFormSelectPageDTO dto);
/**
* 家长端查询已经填报的申请数据
*
* @param dto 查询条件
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.MyApplyFormPageVO>
* @author ZYJ
* @date 2023/11/23 14:43
*/
IPage<MyApplyFormPageVO> listMyApplyFormPage(H5ApplyFormSelectPageDTO dto);
/**
* 家长端查询申请表单详情
*
* @param id 表单id
* @return com.yida.data.customForm.vo.apply.ApplyFormInfoVO
* @author ZYJ
* @date 2023/11/16 15:26
*/
ApplyFormInfoVO getApplyFormInfo(Long id);
/**
* 家长端提交保存申请表单数据
*
* @param dto 家长端申请表单填写信息
* @author ZYJ
* @date 2023/11/16 16:28
*/
void saveApplyFormData(ApplyFormDataInputDTO dto);
/**
* 教师端我审批的申请表单
*
* @param dto 请求参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApprovalApplyFormPageVO>
* @author ZYJ
* @date 2023/11/28 15:03
*/
IPage<ApprovalApplyFormPageVO> findApprovalApplyFormDataList(SelectApprovalApplyFormDataListDTO dto);
/**
* 获取申请表单填报数据
*
* @param dto 表单填报数据请求信息
* @return com.yida.data.customForm.vo.apply.ApplyFormFillUserDataVO
* @author ZYJ
* @date 2023/11/29 15:12
*/
ApplyFormFillUserDataVO getApplyFormFillUserData(ApplyFormFillUserDataDTO dto);
/**
* 填报数据审核
*
* @param dto 审核信息
* @author ZYJ
* @date 2023/11/29 16:01
*/
void auditForm(AuditFormDTO dto);
}
@@ -0,0 +1,25 @@
package com.yida.data.form.apply.service;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.customForm.dto.apply.ApplyFormDataInputDTO;
/**
* 申请类表单填报数据 Service
*
* @author ZYJ
* @date 2023/11/16
*/
public interface ApplyFormDataService {
/**
* 保存申请类型表单填报信息
*
* @param dto 家长端申请表单填写信息
* @param applyForm 申请类型表单信息
* @author ZYJ
* @date 2023/11/16 16:48
*/
void saveFormData(ApplyFormDataInputDTO dto, CoreApplyForm applyForm);
}
@@ -0,0 +1,43 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormApprovalProcess;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.customForm.dto.apply.ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormInfoVO;
import com.yida.data.customForm.vo.apply.ApplyFormProcessSelectVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import java.util.List;
/**
* 申请表单对应的审核流程 Service
*
* @author ZYJ
* @date 2023/11/21
*/
public interface CoreApplyFormApprovalProcessService extends IService<CoreApplyFormApprovalProcess> {
/**
* 保存申请表单对应审核流程
*
* @param applyFormId 申请表单id
* @param processList 表单对应审核流程节点集合
* @author ZYJ
* @date 2023/11/22 14:01
*/
void saveApplyFormApprovalProcess(Long applyFormId, List<CoreApplyFormApprovalProcess> processList);
/**
* 查询表单对应的审核流程数据
*
* @param formId 表单id
* @return java.util.List<com.yida.data.customForm.vo.apply.ApplyFormProcessSelectVO>
* @author ZYJ
* @date 2023/12/18 16:50
*/
List<ApplyFormProcessSelectVO> listFormApprovalProcess(Long formId);
}
@@ -0,0 +1,15 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUserApprovalProcessRecord;
/**
* 填报用户表单审核流程记录表(具体的审核信息) Service
*
* @author ZYJ
* @date 2023/11/24
*/
public interface CoreApplyFormFillUserApprovalProcessRecordService extends IService<CoreApplyFormFillUserApprovalProcessRecord> {
}
@@ -0,0 +1,15 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUserApprovalProcess;
/**
* 表单填报用户对应审核流程表 Service
*
* @author ZYJ
* @date 2023/11/24
*/
public interface CoreApplyFormFillUserApprovalProcessService extends IService<CoreApplyFormFillUserApprovalProcess> {
}
@@ -0,0 +1,42 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUser;
import com.yida.data.customForm.dto.apply.ApplyFormFillSelectPageDTO;
import com.yida.data.customForm.dto.apply.H5ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormFillSelectPageVO;
import com.yida.data.customForm.vo.apply.MyApplyFormPageVO;
import java.util.List;
/**
* 申请表单填报用户信息表 Service
*
* @author ZYJ
* @date 2023/11/22
*/
public interface CoreApplyFormFillUserService extends IService<CoreApplyFormFillUser> {
/**
* 查询用户已经填报的数据
*
* @param dto 查询条件
* @param userIds 填报用户id集合
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.MyApplyFormPageVO>
* @author ZYJ
* @date 2023/11/23 15:05
*/
IPage<MyApplyFormPageVO> selectUserFillForm(H5ApplyFormSelectPageDTO dto, List<Long> userIds);
/**
* 查询申请表单填报列表数据
*
* @param dto 表单填报数据后台列表请求类
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApplyFormFillSelectPageVO>
* @author ZYJ
* @date 2023/12/7 15:05
*/
IPage<ApplyFormFillSelectPageVO> listApplyFormFillPage(ApplyFormFillSelectPageDTO dto);
}
@@ -0,0 +1,16 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormItemChildren;
/**
* 申请类型表单组件选项 Service
*
* @author ZYJ
* @date 2023/11/14
*/
public interface CoreApplyFormItemChildrenService extends IService<CoreApplyFormItemChildren> {
}
@@ -0,0 +1,16 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormItem;
/**
* 申请类型表单组件 Service
*
* @author ZYJ
* @date 2023/11/14
*/
public interface CoreApplyFormItemService extends IService<CoreApplyFormItem> {
}
@@ -0,0 +1,66 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApplyForm;
import com.yida.data.customForm.dto.apply.ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormInfoVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
/**
* 申请类型表单 Service
*
* @author ZYJ
* @date 2023/11/14
*/
public interface CoreApplyFormService extends IService<CoreApplyForm> {
/**
* 查询申请表单列表数据
*
* @param dto 申请表单后台列表请求类
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO>
* @author ZYJ
* @date 2023/11/14 16:07
*/
IPage<ApplyFormSelectPageVO> listApplyFormPage(ApplyFormSelectPageDTO dto);
/**
* 查询申请表单详情
*
* @param id 表单id
* @return com.yida.data.customForm.vo.apply.ApplyFormInfoVO
* @author ZYJ
* @date 2023/11/14 17:34
*/
ApplyFormInfoVO getApplyFormInfo(Long id);
/**
* 删除申请表单
*
* @param id 表单id
* @author ZYJ
* @date 2023/11/14 20:21
*/
void deleteApplyForm(Long id);
/**
* 保存申请表单
*
* @param applyForm 申请表单信息
* @author ZYJ
* @date 2023/11/15 11:28
*/
Long saveApplyForm(CoreApplyForm applyForm);
/**
* 修改申请表单状态
*
* @param formId 表单id
* @param enableStatus 状态. 0为停用,1为启用
* @author ZYJ
* @date 2023/11/15 16:09
*/
void updateEnableStatus(Long formId, Integer enableStatus);
}
@@ -0,0 +1,68 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.customForm.dto.apply.ApprovalProcessSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApprovalProcessInfoVO;
import com.yida.data.customForm.vo.apply.ApprovalProcessSelectPageVO;
import java.util.List;
/**
* 审核流程表 Service
*
* @author ZYJ
* @date 2023/11/21
*/
public interface CoreApprovalProcessService extends IService<CoreApprovalProcess> {
/**
* 查询审核流程节点列表数据
*
* @param dto 审核流程节点后台列表请求类
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.ApprovalProcessSelectPageVO>
* @author ZYJ
* @date 2023/11/21 15:12
*/
IPage<ApprovalProcessSelectPageVO> listApprovalProcessPage(ApprovalProcessSelectPageDTO dto);
/**
* 查询审核流程节点详情
*
* @param id 审核流程节点id
* @return com.yida.data.customForm.vo.apply.ApprovalProcessInfoVO
* @author ZYJ
* @date 2023/11/21 16:03
*/
ApprovalProcessInfoVO getApprovalProcessInfo(Long id);
/**
* 删除审核流程节点
*
* @param id 审核流程节点id
* @author ZYJ
* @date 2023/11/21 16:35
*/
void deleteApprovalProcess(Long id);
/**
* 保存审核流程节点
*
* @param process 保存的节点信息
* @author ZYJ
* @date 2023/11/21 16:51
*/
void saveApprovalProcess(CoreApprovalProcess process);
/**
* 查询所有审核流程节点数据(排除当前表单包含的数据)
*
* @param formId 表单id
* @return java.util.List<com.yida.data.common.core.entity.applyForm.CoreApprovalProcess>
* @author ZYJ
* @date 2023/12/19 14:17
*/
List<CoreApprovalProcess> listApprovalProcess(Long formId);
}
@@ -0,0 +1,16 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcessUser;
/**
* 审核流程人员配置表 Service
*
* @author ZYJ
* @date 2023/11/21
*/
public interface CoreApprovalProcessUserService extends IService<CoreApprovalProcessUser> {
}
@@ -0,0 +1,34 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreApprovalRemind;
import com.yida.data.customForm.dto.apply.ApprovalRemindDTO;
import com.yida.data.customForm.vo.apply.ApprovalRemindInfoVO;
/**
* 审核提醒策略表 Service
*
* @author ZYJ
* @date 2023/11/23
*/
public interface CoreApprovalRemindService extends IService<CoreApprovalRemind> {
/**
* 查询审核提醒策略详情
*
* @return com.yida.data.customForm.vo.apply.ApprovalRemindInfoVO
* @author ZYJ
* @date 2023/12/21 15:19
*/
ApprovalRemindInfoVO getApprovalRemindInfo();
/**
* 保存审核提醒策略
*
* @param dto 保存审核提醒策略请求类
* @author ZYJ
* @date 2023/12/21 15:26
*/
void saveApprovalRemind(ApprovalRemindDTO dto);
}
@@ -0,0 +1,67 @@
package com.yida.data.form.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.applyForm.CoreOfficialSeal;
import com.yida.data.customForm.dto.apply.OfficialSealSaveDTO;
import com.yida.data.customForm.dto.apply.OfficialSealSelectPageDTO;
import com.yida.data.customForm.vo.apply.OfficialSealInfoVO;
import com.yida.data.customForm.vo.apply.OfficialSealSelectPageVO;
/**
* 学校公章 Service
*
* @author ZYJ
* @date 2023/11/17
*/
public interface CoreOfficialSealService extends IService<CoreOfficialSeal> {
/**
* 查询学校公章列表数据
*
* @param dto 查询条件
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.yida.data.customForm.vo.apply.OfficialSealSelectPageVO>
* @author ZYJ
* @date 2023/11/17 15:44
*/
IPage<OfficialSealSelectPageVO> listOfficialSealPage(OfficialSealSelectPageDTO dto);
/**
* 查询公章详情
*
* @param id 公章id
* @return com.yida.data.customForm.vo.apply.OfficialSealInfoVO
* @author ZYJ
* @date 2023/11/17 16:48
*/
OfficialSealInfoVO getOfficialSealInfo(Long id);
/**
* 删除公章
*
* @param id 公章id
* @author ZYJ
* @date 2023/11/17 17:07
*/
void deleteOfficialSeal(Long id);
/**
* 保存公章
*
* @param dto 保存的公章信息
* @author ZYJ
* @date 2023/11/17 17:32
*/
void saveOfficialSeal(OfficialSealSaveDTO dto);
/**
* 修改公章状态
*
* @param id 表单id
* @param enableStatus 状态. 0为停用,1为启用
* @author ZYJ
* @date 2023/11/17 17:35
*/
void updateEnableStatus(Long id, Integer enableStatus);
}
@@ -0,0 +1,39 @@
package com.yida.data.form.apply.service;
import com.yida.data.common.core.entity.system.Dept;
import com.yida.data.common.core.entity.user.EduStudent;
import com.yida.data.customForm.dto.apply.SendParentNoticeDTO;
import com.yida.data.customForm.dto.apply.SendStaffNoticeDTO;
import org.springframework.scheduling.annotation.Async;
import java.time.LocalDateTime;
/**
* 发送消息 Service
*
* @author ZYJ
* @date 2023/11/30
*/
public interface SendNoticeService {
/**
* 发送申请表单职工企业微信端模板消息
*
* @param dto 发送职工表单审核模板消息 数据封装类
* @param isFirst 是否为初次审核 0否,1是
* @author ZYJ
* @date 2023/11/28 14:09
*/
@Async
void sendStaffNotice(SendStaffNoticeDTO dto, Integer isFirst);
/**
* 发送申请表单家长企业微信端模板消息
*
* @param dto 消息信息
* @author ZYJ
* @date 2023/11/30 17:07
*/
@Async
void sendParentNotice(SendParentNoticeDTO dto);
}
@@ -0,0 +1,532 @@
package com.yida.data.form.apply.service.impl;
import cc.mrbird.febs.common.redis.service.RedisService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.applyForm.*;
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
import com.yida.data.common.core.entity.system.Dept;
import com.yida.data.common.core.entity.user.EduStaff;
import com.yida.data.common.core.entity.user.EduStudent;
import com.yida.data.common.core.entity.user.EduUserDept;
import com.yida.data.common.core.enums.EnableStatusEnum;
import com.yida.data.common.core.enums.RoleName;
import com.yida.data.common.core.enums.leave.ApprovalResultEnum;
import com.yida.data.common.core.enums.leave.AuditModeEnum;
import com.yida.data.common.core.exception.FebsException;
import com.yida.data.common.service.CommonService;
import com.yida.data.customForm.dto.apply.*;
import com.yida.data.customForm.vo.apply.*;
import com.yida.data.form.apply.mapper.ApplyFormDataMapper;
import com.yida.data.form.apply.mapper.CoreApplyFormFillUserMapper;
import com.yida.data.form.apply.service.*;
import com.yida.data.user.dto.ListStaffDTO;
import com.yida.data.user.feign.RemoteStaffService;
import com.yida.data.user.feign.RemoteStudentService;
import com.yida.data.user.feign.RemoteUserDeptService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* H5--申请类表单管理 Service
*
* @author ZYJ
* @date 2023/11/15 20:38
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class AppApplyFormServiceImpl implements AppApplyFormService {
private final SendNoticeService sendNoticeService;
private final ApplyFormDataService applyFormDataService;
private final CoreApplyFormService coreApplyFormService;
private final CoreApplyFormItemService coreApplyFormItemService;
private final CoreApprovalProcessService coreApprovalProcessService;
private final CoreApplyFormFillUserService coreApplyFormFillUserService;
private final CoreApplyFormItemChildrenService coreApplyFormItemChildrenService;
private final CoreApplyFormFillUserApprovalProcessService coreApplyFormFillUserApprovalProcessService;
private final CoreApplyFormFillUserApprovalProcessRecordService coreApplyFormFillUserApprovalProcessRecordService;
private final ApplyFormDataMapper applyFormDataMapper;
private final CoreApplyFormFillUserMapper coreApplyFormFillUserMapper;
private final RemoteStaffService remoteStaffService;
private final RemoteStudentService remoteStudentService;
private final RemoteUserDeptService remoteUserDeptService;
private final RedisService redisService;
private final CommonService commonService;
@Override
public IPage<ApplyFormSelectPageVO> listApplyFormPage(H5ApplyFormSelectPageDTO dto) {
ApplyFormSelectPageDTO selectPageDTO = new ApplyFormSelectPageDTO();
selectPageDTO.setDeptId(dto.getDeptId());
selectPageDTO.setStatus(EnableStatusEnum.ENABLE_STATUS.getStatus());
selectPageDTO.setPageNum(dto.getPageNum());
selectPageDTO.setPageSize(dto.getPageSize());
// 查询表单信息
return coreApplyFormService.listApplyFormPage(selectPageDTO);
}
@Override
public IPage<MyApplyFormPageVO> listMyApplyFormPage(H5ApplyFormSelectPageDTO dto) {
// 查询学生列表
List<EduStudent> studentList = remoteStudentService.listStudentByParent(dto.getParentId()).getData();
if (CollUtil.isEmpty(studentList)) {
return new Page<>();
}
Map<Long, List<EduStudent>> studentListMap = studentList.stream().collect(Collectors.groupingBy(EduStudent::getId));
// 查询用户已经填报的数据
List<Long> studentIds = studentList.stream().map(EduStudent::getId).collect(Collectors.toList());
IPage<MyApplyFormPageVO> page = coreApplyFormFillUserService.selectUserFillForm(dto, studentIds);
page.getRecords().forEach(myApplyFormPageVO -> {
// 处理学生信息
EduStudent eduStudent = studentListMap.get(myApplyFormPageVO.getUserId()).get(0);
myApplyFormPageVO.setUserName(eduStudent.getStuName());
myApplyFormPageVO.setUserPicUrl(eduStudent.getAvatar());
});
return page;
}
@Override
public ApplyFormInfoVO getApplyFormInfo(Long id) {
return coreApplyFormService.getApplyFormInfo(id);
}
@Override
public void saveApplyFormData(ApplyFormDataInputDTO dto) {
CoreApplyForm applyForm = coreApplyFormService.getById(dto.getFormId());
if (Objects.isNull(applyForm)) {
throw new FebsException("申请表信息异常");
}
applyFormDataService.saveFormData(dto, applyForm);
}
@Override
public IPage<ApprovalApplyFormPageVO> findApprovalApplyFormDataList(SelectApprovalApplyFormDataListDTO dto) {
LocalDateTime preDateTime = LocalDate.now().minusMonths(1).atTime(23, 59, 59);
// 职工参与审核的填报用户信息
List<CoreApplyFormFillUser> approvalUserFormList = coreApplyFormFillUserMapper.findApprovalFormDataFillUserList(dto, preDateTime);
if (CollUtil.isEmpty(approvalUserFormList)) {
return new Page<>();
}
// 如果表单已通过或者未通过,表示已处理了
List<CoreApplyFormFillUser> dealEdList = approvalUserFormList.stream()
.filter(e -> ObjectUtil.equals(ApprovalResultEnum.AUDIT_PASS.getResult(), e.getExamineStatus())
|| ObjectUtil.equals(ApprovalResultEnum.AUDIT_NO.getResult(), e.getExamineStatus()))
.collect(Collectors.toList());
List<Long> dealEdIdList = dealEdList.stream().map(CoreApplyFormFillUser::getId).collect(Collectors.toList());
// 待处理/正在处理的请假
List<CoreApplyFormFillUser> dealIngList = approvalUserFormList.stream()
.filter(e -> ObjectUtil.equals(ApprovalResultEnum.AUDIT.getResult(), e.getExamineStatus())
|| ObjectUtil.equals(ApprovalResultEnum.AUDIT_ING.getResult(), e.getExamineStatus()))
.collect(Collectors.toList());
List<Long> dealIngIdList = new ArrayList<>();
for (CoreApplyFormFillUser fillUser : dealIngList) {
// 待审核
List<CoreApplyFormFillUserApprovalProcess> userApprovalProcessList = coreApplyFormFillUserApprovalProcessService
.list(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcess())
.eq(CoreApplyFormFillUserApprovalProcess::getFillUserId, fillUser.getId())
.eq(CoreApplyFormFillUserApprovalProcess::getExamineStatus, ApprovalResultEnum.AUDIT.getResult())
.orderByAsc(CoreApplyFormFillUserApprovalProcess::getSort));
if (CollUtil.isEmpty(userApprovalProcessList)) {
continue;
}
// 下一级审核
CoreApplyFormFillUserApprovalProcess userApprovalProcess = userApprovalProcessList.get(0);
List<CoreApplyFormFillUserApprovalProcessRecord> recordList = coreApplyFormFillUserApprovalProcessRecordService
.list(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcessRecord())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getFillUserId, fillUser.getId())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getUserProcessId, userApprovalProcess.getId()));
if (recordList.stream().map(CoreApplyFormFillUserApprovalProcessRecord::getApprovalId)
.collect(Collectors.toList()).contains(dto.getUserId())) {
dealIngIdList.add(fillUser.getId());
}
// 已审核通过
List<CoreApplyFormFillUserApprovalProcess> userApprovalProcessPassList = coreApplyFormFillUserApprovalProcessService
.list(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcess())
.eq(CoreApplyFormFillUserApprovalProcess::getFillUserId, fillUser.getId())
.eq(CoreApplyFormFillUserApprovalProcess::getExamineStatus, ApprovalResultEnum.AUDIT_PASS.getResult())
.orderByAsc(CoreApplyFormFillUserApprovalProcess::getSort));
if (CollUtil.isEmpty(userApprovalProcessPassList)) {
continue;
}
List<CoreApplyFormFillUserApprovalProcessRecord> passRecordList = coreApplyFormFillUserApprovalProcessRecordService
.list(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcessRecord())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getFillUserId, fillUser.getId())
.in(CoreApplyFormFillUserApprovalProcessRecord::getUserProcessId,
userApprovalProcessPassList.stream().map(CoreApplyFormFillUserApprovalProcess::getId).collect(
Collectors.toList())));
if (passRecordList.stream().map(CoreApplyFormFillUserApprovalProcessRecord::getApprovalId)
.collect(Collectors.toList()).contains(dto.getUserId())) {
dealEdIdList.add(fillUser.getId());
}
}
if (CollUtil.isEmpty(dealEdIdList)) {
dealEdIdList.add(-1L);
}
if (CollUtil.isEmpty(dealIngIdList)) {
dealIngIdList.add(-1L);
}
ApprovalFillUserFormPageDTO pageDTO = new ApprovalFillUserFormPageDTO();
pageDTO.setPageNum(dto.getPageNum());
pageDTO.setPageSize(dto.getPageSize());
pageDTO.setSchoolId(dto.getSchoolId());
pageDTO.setFillUserIds(
ObjectUtil.equals(ApprovalResultEnum.AUDIT.getResult(), dto.getCurrentUserStatus()) ? dealIngIdList : dealEdIdList);
// 查询教师审核的表单分页数据
IPage<ApprovalApplyFormPageVO> page = coreApplyFormFillUserMapper.selectApprovalUserFillForm(pageDTO.toPage(), pageDTO);
for (ApprovalApplyFormPageVO record : page.getRecords()) {
// 学生
EduStudent student = commonService.getStudentById(record.getUserId());
if (ObjectUtil.isNull(student)) {
log.error("学生【{}】不存在,无法处理申请表单数据", record.getUserId().toString());
continue;
}
EduUserDept userGreadeDept = (EduUserDept) redisService
.hget(CachePrefixConstant.USER_DEPT_DATA, student.getGradeId().toString());
EduUserDept userClassDept = (EduUserDept) redisService
.hget(CachePrefixConstant.USER_DEPT_DATA, student.getClassId().toString());
if (ObjectUtil.isNull(userGreadeDept)) {
userGreadeDept = remoteUserDeptService.getByDeptId(student.getGradeId()).getData();
if (ObjectUtil.isNotNull(userGreadeDept)) {
redisService.hset(CachePrefixConstant.USER_DEPT_DATA, student.getGradeId().toString(), userGreadeDept);
}
}
if (ObjectUtil.isNull(userClassDept)) {
userClassDept = remoteUserDeptService.getByDeptId(student.getClassId()).getData();
if (ObjectUtil.isNotNull(userClassDept)) {
redisService.hset(CachePrefixConstant.USER_DEPT_DATA, student.getClassId().toString(), userClassDept);
}
}
if (ObjectUtil.isNull(userGreadeDept) && ObjectUtil.isNull(userGreadeDept)) {
record.setUserDeptName("未知班级");
} else {
record.setUserDeptName(
(ObjectUtil.isNull(userGreadeDept) ? "" : userGreadeDept.getDeptName()) + (ObjectUtil
.isNull(userClassDept) ? "" : userClassDept.getDeptName()));
}
record.setUserPicUrl(student.getAvatar());
}
return page;
}
@Override
public ApplyFormFillUserDataVO getApplyFormFillUserData(ApplyFormFillUserDataDTO dto) {
// 返回信息
ApplyFormFillUserDataVO vo = new ApplyFormFillUserDataVO();
// 查询填报用户信息
CoreApplyFormFillUser fillUser = coreApplyFormFillUserService.getById(dto.getFillUserId());
vo.setFillUserId(fillUser.getId());
// 表单信息
CoreApplyForm applyForm = coreApplyFormService.getById(dto.getApplyFormId());
BeanUtils.copyProperties(applyForm, vo);
// 查询组件信息
List<CoreApplyFormItem> itemList = coreApplyFormItemService.list(Wrappers.<CoreApplyFormItem>query().lambda()
.eq(CoreApplyFormItem::getFormId, dto.getApplyFormId()));
itemList.forEach(item -> {
// 查询组件选项信息
List<CoreApplyFormItemChildren> childrenList =
coreApplyFormItemChildrenService.list(Wrappers.<CoreApplyFormItemChildren>query().lambda()
.eq(CoreApplyFormItemChildren::getFormItemId, item.getId()));
item.setChildrenList(childrenList);
});
vo.setItemList(itemList);
// 查询对应的填报信息
Map<String, Object> parameterMap = new HashMap<>();
String sql = "select * from " + applyForm.getTableName() + " where id = #{parameterMap.id}";
parameterMap.put("id", fillUser.getApplyFormDataId());
Map fillUserData = applyFormDataMapper.findFillUserData(sql, parameterMap);
vo.setFillUserData(fillUserData);
// 查询填报用户对应的审核流程
List<CoreApplyFormFillUserApprovalProcess> userApprovalProcessList = coreApplyFormFillUserApprovalProcessService
.list(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcess())
.eq(CoreApplyFormFillUserApprovalProcess::getFillUserId, fillUser.getId())
.orderByAsc(CoreApplyFormFillUserApprovalProcess::getSort));
userApprovalProcessList.forEach(userApprovalProcess -> {
List<CoreApplyFormFillUserApprovalProcessRecord> recordList = coreApplyFormFillUserApprovalProcessRecordService
.list(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcessRecord())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getFillUserId, fillUser.getId())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getUserProcessId, userApprovalProcess.getId()));
// 查询审核人信息
ListStaffDTO staffDTO = new ListStaffDTO();
staffDTO.setIds(recordList.stream().map(CoreApplyFormFillUserApprovalProcessRecord::getApprovalId)
.collect(Collectors.toList()));
for (CoreApplyFormFillUserApprovalProcessRecord record : recordList) {
EduStaff staff = (EduStaff) redisService.hget(CachePrefixConstant.STAFF_DATA, record.getApprovalId().toString());
if (Objects.isNull(staff)) {
staff = remoteStaffService.getStaff(record.getApprovalId()).getData();
if (Objects.nonNull(staff)) {
redisService
.hset(CachePrefixConstant.STAFF_DATA, record.getApprovalId().toString(), staff);
}
}
if (Objects.nonNull(staff)) {
record.setApprovalInfo(staff);
}
}
userApprovalProcess.setRecordList(recordList);
});
vo.setUserApprovalProcessList(userApprovalProcessList);
// 学生信息
EduStudent student = (EduStudent) redisService
.hget(CachePrefixConstant.STUDENT_DATA, fillUser.getUserId().toString());
if (Objects.isNull(student)) {
student = remoteStudentService.getStudentNoPermission(fillUser.getUserId()).getData();
if (ObjectUtil.isNotNull(student)) {
redisService.hset(CachePrefixConstant.STUDENT_DATA, fillUser.getUserId().toString(), student);
}
}
vo.setStudent(student);
return vo;
}
@Override
public void auditForm(AuditFormDTO dto) {
// 填报信息主体
CoreApplyFormFillUser fillUser = coreApplyFormFillUserService.getById(dto.getFillUserId());
// 查询学生
EduStudent student = (EduStudent) redisService
.hget(CachePrefixConstant.STUDENT_DATA, fillUser.getUserId().toString());
if (Objects.isNull(student)) {
student = remoteStudentService.getStudentNoPermission(fillUser.getUserId()).getData();
if (student == null) {
throw new FebsException("学生信息错误,请联系管理员");
} else {
redisService.hset(CachePrefixConstant.STUDENT_DATA, fillUser.getUserId().toString(), student);
}
}
// 查询学校信息
Dept school = commonService.getDept(student.getSchoolId());
// 封装消息发送对象
SendStaffNoticeDTO sendStaffNoticeDTO = new SendStaffNoticeDTO();
sendStaffNoticeDTO.setSchoolId(student.getSchoolId());
sendStaffNoticeDTO.setSchoolType(school.getSchoolType());
sendStaffNoticeDTO.setCreateTime(LocalDateTime.now());
sendStaffNoticeDTO.setUserName(student.getStuName());
sendStaffNoticeDTO.setUserDeptName(
String.join("/", student.getCampusName(), student.getGradeName(), student.getClassName()));
sendStaffNoticeDTO.setFormId(fillUser.getApplyFormId());
sendStaffNoticeDTO.setFillUserId(fillUser.getId());
sendStaffNoticeDTO.setUserId(student.getId());
// 判断审核权限
List<CoreApplyFormFillUserApprovalProcessRecord> list = coreApplyFormFillUserApprovalProcessRecordService.list(
Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcessRecord())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getFillUserId, fillUser.getId())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getApprovalId, dto.getApprovalId())
.orderByAsc(CoreApplyFormFillUserApprovalProcessRecord::getSort));
// 获取当前审核数据
CoreApplyFormFillUserApprovalProcessRecord processRecord = new CoreApplyFormFillUserApprovalProcessRecord();
for (CoreApplyFormFillUserApprovalProcessRecord record : list) {
if (record.getApprovalResult() == 0) {
processRecord = record;
break;
}
}
// 保存审核流程记录
processRecord.setApprovalResult(dto.getApprovalResult() == 0 ? 2 : 1);
processRecord.setApprovalReason(dto.getApprovalReason());
processRecord.setSignPic(dto.getSignPic());
processRecord.setAuditTime(LocalDateTime.now());
processRecord.setUpdateDate(LocalDateTime.now());
coreApplyFormFillUserApprovalProcessRecordService.updateById(processRecord);
// 查询对应的用户审核流程
CoreApplyFormFillUserApprovalProcess userApprovalProcess =
coreApplyFormFillUserApprovalProcessService.getById(processRecord.getUserProcessId());
// 查询审核流程具体信息
CoreApprovalProcess approvalProcess = coreApprovalProcessService.getById(userApprovalProcess.getProcessId());
sendStaffNoticeDTO.setPreStaffName(processRecord.getApprovalName());
// 查询角色名称
List<String> roleNames = new ArrayList<>();
List<Integer> teacherRoleTypeList = remoteStaffService
.listStaffRolesByStaffId(processRecord.getApprovalId()).getData();
if (teacherRoleTypeList.contains(1)) {
roleNames.add(RoleName.CAMPUS.getName());
} else if (teacherRoleTypeList.contains(2)) {
roleNames.add(RoleName.GRADE.getName());
} else if (teacherRoleTypeList.contains(3)) {
roleNames.add(RoleName.MASTER.getName());
} else if (teacherRoleTypeList.contains(4)) {
roleNames.add(RoleName.COURSE.getName());
} else if (teacherRoleTypeList.contains(5)) {
roleNames.add(RoleName.SECTION.getName());
} else {
roleNames.add(RoleName.TEACHER.getName());
}
sendStaffNoticeDTO.setPreStaffRoleName(StrUtil.join("/", roleNames));
// 或审
if (ObjectUtil.equals(AuditModeEnum.OR_AUDIT.getMode(), approvalProcess.getApprovalType())) {
userApprovalProcess.setExamineStatus(dto.getApprovalResult() == 0 ? 2 : 1);
userApprovalProcess.setAuditTime(LocalDateTime.now());
// 查询用户下一个审核流程
CoreApplyFormFillUserApprovalProcess nextUserApprovalProcess = coreApplyFormFillUserApprovalProcessService
.getOne(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcess())
.eq(CoreApplyFormFillUserApprovalProcess::getFillUserId, fillUser.getId())
.eq(CoreApplyFormFillUserApprovalProcess::getSort, userApprovalProcess.getSort() + 1));
// 用户填报信息
CoreApplyFormFillUser saveFillUser = new CoreApplyFormFillUser();
saveFillUser.setId(fillUser.getId());
// 无下一个用户审核流程则表示审核完毕
if (Objects.isNull(nextUserApprovalProcess)) {
// 审核通过
if (ObjectUtil.equals(ApprovalResultEnum.AUDIT_PASS.getResult(), dto.getApprovalResult())) {
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_PASS.getResult());
} else {
// 审核不通过
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_NO.getResult());
saveFillUser.setRefuseReason(dto.getRefuseReason());
}
saveFillUser.setAuditTime(LocalDateTime.now());
} else {
// 有下一个用户审核流程
if (ObjectUtil.equals(ApprovalResultEnum.AUDIT_PASS.getResult(), dto.getApprovalResult())) {
// 当前节点审核通过, 用户修改为审核中
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_ING.getResult());
// 查询下一个审核节点的审核人信息
List<CoreApplyFormFillUserApprovalProcessRecord> nextAppUser = coreApplyFormFillUserApprovalProcessRecordService.list(
Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcessRecord())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getUserProcessId, nextUserApprovalProcess.getId()));
nextAppUser.forEach(record -> {
// 发送提示审核消息
EduStaff staff = remoteStaffService.getStaff(record.getApprovalId()).getData();
sendStaffNoticeDTO.setStaffWxId(staff.getWxId());
sendStaffNoticeDTO.setStaffName(staff.getName());
sendStaffNoticeDTO.setSchoolType(school.getSchoolType());
sendNoticeService.sendStaffNotice(sendStaffNoticeDTO, 0);
});
} else {
// 审核不通过
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_NO.getResult());
saveFillUser.setRefuseReason(dto.getRefuseReason());
saveFillUser.setAuditTime(LocalDateTime.now());
}
}
coreApplyFormFillUserService.updateById(saveFillUser);
// 给家长发送审核结果信息
if (ObjectUtil.equals(ApprovalResultEnum.AUDIT_PASS.getResult(), saveFillUser.getExamineStatus())
|| ObjectUtil.equals(ApprovalResultEnum.AUDIT_NO.getResult(), saveFillUser.getExamineStatus())) {
CoreApplyFormFillUser user = coreApplyFormFillUserService.getById(saveFillUser.getId());
sendNoticeService.sendParentNotice(
SendParentNoticeDTO.builder()
.school(school)
.student(student)
.examineStatus(saveFillUser.getExamineStatus())
.createTime(user.getCreateDate())
.formId(fillUser.getApplyFormId())
.fillUserId(user.getId())
.build()
);
}
} else {
// 会审
// 本次审核流程对应的全部审核人员
List<CoreApplyFormFillUserApprovalProcessRecord> recordList = coreApplyFormFillUserApprovalProcessRecordService
.list(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcessRecord())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getUserProcessId, processRecord.getUserProcessId())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getFillUserId, fillUser.getId()));
// 已通过的人员
List<CoreApplyFormFillUserApprovalProcessRecord> passRecordList = recordList.stream()
.filter(x -> ObjectUtil.equals(ApprovalResultEnum.AUDIT_PASS.getResult(), x.getApprovalResult()))
.collect(Collectors.toList());
// 用户填报信息
CoreApplyFormFillUser saveFillUser = new CoreApplyFormFillUser();
saveFillUser.setId(fillUser.getId());
// 审核通过
if (ObjectUtil.equals(ApprovalResultEnum.AUDIT_PASS.getResult(), dto.getApprovalResult())) {
// 本次流程全部审核通过
if (recordList.size() == passRecordList.size()) {
// 查询用户下一个审核流程
CoreApplyFormFillUserApprovalProcess nextUserApprovalProcess = coreApplyFormFillUserApprovalProcessService
.getOne(Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcess())
.eq(CoreApplyFormFillUserApprovalProcess::getFillUserId, fillUser.getId())
.eq(CoreApplyFormFillUserApprovalProcess::getSort, userApprovalProcess.getSort() + 1));
// 无下一个用户审核流程则表示审核完毕
if (Objects.isNull(nextUserApprovalProcess)) {
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_PASS.getResult());
saveFillUser.setAuditTime(LocalDateTime.now());
// 给家长发送审核结果信息
CoreApplyFormFillUser user = coreApplyFormFillUserService.getById(saveFillUser.getId());
sendNoticeService.sendParentNotice(
SendParentNoticeDTO.builder()
.school(school)
.student(student)
.examineStatus(saveFillUser.getExamineStatus())
.createTime(user.getCreateDate())
.formId(fillUser.getApplyFormId())
.fillUserId(user.getId())
.build()
);
} else {
// 有下一个用户审核流程
// 当前节点审核通过, 用户修改为审核中
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_ING.getResult());
// 查询下一个审核节点的审核人信息
List<CoreApplyFormFillUserApprovalProcessRecord> nextAppUser = coreApplyFormFillUserApprovalProcessRecordService.list(
Wrappers.lambdaQuery(new CoreApplyFormFillUserApprovalProcessRecord())
.eq(CoreApplyFormFillUserApprovalProcessRecord::getUserProcessId, nextUserApprovalProcess.getId()));
nextAppUser.forEach(record -> {
// 发送提示审核消息
EduStaff staff = remoteStaffService.getStaff(record.getApprovalId()).getData();
sendStaffNoticeDTO.setStaffWxId(staff.getWxId());
sendStaffNoticeDTO.setStaffName(staff.getName());
sendStaffNoticeDTO.setSchoolType(school.getSchoolType());
sendNoticeService.sendStaffNotice(sendStaffNoticeDTO, 0);
});
}
// 当前用户审核流程修改为通过
userApprovalProcess.setExamineStatus(ApprovalResultEnum.AUDIT_PASS.getResult());
userApprovalProcess.setAuditTime(LocalDateTime.now());
} else {
// 本次流程还有未审核通过的人员
userApprovalProcess.setExamineStatus(ApprovalResultEnum.AUDIT_ING.getResult()); //当前流程审核中
userApprovalProcess.setAuditTime(LocalDateTime.now());
// 当前人员修改为审核中
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_ING.getResult());
}
} else {
// 审核不通过
saveFillUser.setExamineStatus(ApprovalResultEnum.AUDIT_NO.getResult());
saveFillUser.setRefuseReason(dto.getRefuseReason());
saveFillUser.setAuditTime(LocalDateTime.now());
// 当前用户审核流程修改为不通过
userApprovalProcess.setExamineStatus(ApprovalResultEnum.AUDIT_NO.getResult());
userApprovalProcess.setAuditTime(LocalDateTime.now());
// 给家长发送审核结果信息
CoreApplyFormFillUser user = coreApplyFormFillUserService.getById(saveFillUser.getId());
sendNoticeService.sendParentNotice(
SendParentNoticeDTO.builder()
.school(school)
.student(student)
.examineStatus(saveFillUser.getExamineStatus())
.createTime(user.getCreateDate())
.formId(fillUser.getApplyFormId())
.fillUserId(user.getId())
.build()
);
}
coreApplyFormFillUserService.updateById(saveFillUser);
}
coreApplyFormFillUserApprovalProcessService.updateById(userApprovalProcess);
}
}
@@ -0,0 +1,214 @@
package com.yida.data.form.apply.service.impl;
import cc.mrbird.febs.common.redis.service.RedisService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.entity.applyForm.*;
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
import com.yida.data.common.core.entity.system.Dept;
import com.yida.data.common.core.entity.system.enums.SchoolNatureEnum;
import com.yida.data.common.core.entity.user.EduStaff;
import com.yida.data.common.core.entity.user.EduStudent;
import com.yida.data.common.core.enums.ApprovalRoleTypeEnum;
import com.yida.data.common.core.enums.AuditStatusEnum;
import com.yida.data.common.core.exception.FebsException;
import com.yida.data.common.service.CommonService;
import com.yida.data.customForm.dto.apply.ApplyFormDataInputDTO;
import com.yida.data.customForm.dto.apply.SendStaffNoticeDTO;
import com.yida.data.form.apply.mapper.ApplyFormDataMapper;
import com.yida.data.form.apply.mapper.CoreApplyFormApprovalProcessMapper;
import com.yida.data.form.apply.service.*;
import com.yida.data.user.feign.RemoteStaffService;
import com.yida.data.user.feign.RemoteStudentService;
import com.yida.data.user.feign.RemoteTeacherService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.*;
/**
* 申请类表单填报数据 Service
*
* @author ZYJ
* @date 2023/11/16
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class ApplyFormDataServiceImpl implements ApplyFormDataService {
private final SendNoticeService sendNoticeService;
private final CoreApplyFormFillUserService coreApplyFormFillUserService;
private final CoreApprovalProcessUserService coreApprovalProcessUserService;
private final CoreApplyFormFillUserApprovalProcessService coreApplyFormFillUserApprovalProcessService;
private final CoreApplyFormFillUserApprovalProcessRecordService coreApplyFormFillUserApprovalProcessRecordService;
private final ApplyFormDataMapper applyFormDataMapper;
private final CoreApplyFormApprovalProcessMapper coreApplyFormApprovalProcessMapper;
private final RemoteStaffService remoteStaffService;
private final RemoteTeacherService remoteTeacherService;
private final RemoteStudentService remoteStudentService;
private final RedisService redisService;
private final CommonService commonService;
@Override
public void saveFormData(ApplyFormDataInputDTO dto, CoreApplyForm applyForm) {
// 查询学生
EduStudent student = (EduStudent) redisService
.hget(CachePrefixConstant.STUDENT_DATA, dto.getUserId().toString());
if (Objects.isNull(student)) {
student = remoteStudentService.getStudentNoPermission(dto.getUserId()).getData();
if (student == null) {
throw new FebsException("学生信息错误,请联系管理员");
} else {
redisService.hset(CachePrefixConstant.STUDENT_DATA, dto.getUserId().toString(), student);
}
}
// 查询学校信息
Dept school = commonService.getDept(applyForm.getSchoolId());
// 封装消息发送对象
SendStaffNoticeDTO sendStaffNoticeDTO = new SendStaffNoticeDTO();
sendStaffNoticeDTO.setSchoolId(applyForm.getSchoolId());
sendStaffNoticeDTO.setSchoolType(school.getSchoolType());
sendStaffNoticeDTO.setCreateTime(LocalDateTime.now());
sendStaffNoticeDTO.setUserName(student.getStuName());
sendStaffNoticeDTO.setUserDeptName(
String.join("/", student.getCampusName(), student.getGradeName(), student.getClassName()));
sendStaffNoticeDTO.setFormId(dto.getFormId());
sendStaffNoticeDTO.setUserId(student.getId());
// 查询数据表字段
List<String> filedList = applyFormDataMapper.findApplyFormFiled(applyForm.getTableName());
// 填报信息处理
JSONObject jsonObject = JSONUtil.parseObj(dto.getJsonDataString());
// 字段集合
List<String> parameterList = new ArrayList<>();
Map<String, Object> parameterMap = new HashMap<>();
// 处理保存sql语句
String baseSql = "insert into " + applyForm.getTableName() + "(";
filedList.forEach(filed -> {
parameterList.add("#{parameterMap." + filed + "}");
parameterMap.put(filed, jsonObject.get(filed));
});
// 处理其余字段
parameterMap.put("create_date", new Date());
parameterMap.put("user_id", dto.getUserId());
parameterMap.put("examine_status", "0");
// 数据主键id
parameterMap.put("id", null);
String finalSql = baseSql + String.join(",", filedList) + ") values (" + String.join(",", parameterList) + ")";
// 保存数据
applyFormDataMapper.saveFormData(finalSql, parameterMap);
// 处涉及多次填报,添加填报数据主键id
CoreApplyFormFillUser fillUser = CoreApplyFormFillUser.builder()
.schoolId(student.getSchoolId())
.applyFormId(applyForm.getId())
.applyFormDataId((Long) parameterMap.get("id"))
.userId(dto.getUserId())
.userName(student.getStuName())
.build();
// 保存填报记录数据
coreApplyFormFillUserService.save(fillUser);
sendStaffNoticeDTO.setFillUserId(fillUser.getId());
// 查询表单对应的审核流程
List<CoreApprovalProcess> approvalProcessList = coreApplyFormApprovalProcessMapper.selectApplyFormApprovalProcess(applyForm.getId());
for (int i = 0; i < approvalProcessList.size(); i++) {
CoreApprovalProcess approvalProcess = approvalProcessList.get(i);
// 保存填报用户对应的流程
CoreApplyFormFillUserApprovalProcess fillUserApprovalProcess = new CoreApplyFormFillUserApprovalProcess();
fillUserApprovalProcess.setApplyFormId(applyForm.getId());
fillUserApprovalProcess.setFillUserId(fillUser.getId());
fillUserApprovalProcess.setProcessId(approvalProcess.getId());
fillUserApprovalProcess.setProcessName(approvalProcess.getApprovalProcessName());
fillUserApprovalProcess.setApprovalType(approvalProcess.getApprovalType());
fillUserApprovalProcess.setApprovalUserType(approvalProcess.getApprovalUserType());
fillUserApprovalProcess.setSort(i);
coreApplyFormFillUserApprovalProcessService.save(fillUserApprovalProcess);
// 查询审核流程人员信息
List<CoreApprovalProcessUser> processUserList = coreApprovalProcessUserService.list(Wrappers.lambdaQuery(new CoreApprovalProcessUser())
.eq(CoreApprovalProcessUser::getProcessId, approvalProcess.getId()));
for (CoreApprovalProcessUser processUser : processUserList) {
// 职工审核
if (Objects.nonNull(processUser.getStaffId())) {
EduStaff staff = remoteStaffService.getStaff(processUser.getStaffId()).getData();
// 保存具体人员的审核记录
CoreApplyFormFillUserApprovalProcessRecord fillUserApprovalProcessRecord = new CoreApplyFormFillUserApprovalProcessRecord();
fillUserApprovalProcessRecord.setSchoolId(applyForm.getSchoolId());
fillUserApprovalProcessRecord.setApplyFormId(applyForm.getId());
fillUserApprovalProcessRecord.setFillUserId(fillUser.getId());
fillUserApprovalProcessRecord.setUserProcessId(fillUserApprovalProcess.getId());
fillUserApprovalProcessRecord.setApprovalId(processUser.getStaffId());
fillUserApprovalProcessRecord.setApprovalName(staff.getName());
fillUserApprovalProcessRecord.setSort(i);
coreApplyFormFillUserApprovalProcessRecordService.save(fillUserApprovalProcessRecord);
// 发送审核信息
if (i == 0) {
sendStaffNoticeDTO.setStaffWxId(staff.getWxId());
sendStaffNoticeDTO.setStaffName(staff.getName());
sendNoticeService.sendStaffNotice(sendStaffNoticeDTO, 1);
}
} else if (Objects.nonNull(processUser.getStaffRoleId())) {
// 角色审核
// 审核人员信息
List<EduStaff> approvalUserList = new ArrayList<>();
// 班主任
if (ApprovalRoleTypeEnum.CLASS_TEACHER_TYPE.getType().equals(processUser.getStaffRoleId())) {
// 查询学生班主任
approvalUserList = remoteTeacherService.listTeacherByDeptId(student.getClassId(), "3").getData();
} else {
// 高校系主任/K12年级主任
if (student.getSchoolId() == 10593) {
// 技师学院单独处理
approvalUserList = remoteTeacherService.listTeacherByDeptId(student.getCampusId(), "1")
.getData();
} else {
Dept dept = commonService.getDept(student.getSchoolId());
// 学校性质
if (ObjectUtil.equals(SchoolNatureEnum.UNI_TYPE.getValue(),
dept.getSchoolNature())) {
// 高校
approvalUserList = remoteTeacherService.listTeacherByDeptId(student.getSectionId(), "5")
.getData();
} else {
// K12
approvalUserList = remoteTeacherService.listTeacherByDeptId(student.getGradeId(), "2")
.getData();
}
}
}
if (CollUtil.isNotEmpty(approvalUserList)) {
for (EduStaff eduStaff : approvalUserList) {
// 保存具体人员的审核记录
CoreApplyFormFillUserApprovalProcessRecord fillUserApprovalProcessRecord = new CoreApplyFormFillUserApprovalProcessRecord();
fillUserApprovalProcessRecord.setSchoolId(applyForm.getSchoolId());
fillUserApprovalProcessRecord.setApplyFormId(applyForm.getId());
fillUserApprovalProcessRecord.setFillUserId(fillUser.getId());
fillUserApprovalProcessRecord.setUserProcessId(fillUserApprovalProcess.getId());
fillUserApprovalProcessRecord.setApprovalId(eduStaff.getId());
fillUserApprovalProcessRecord.setApprovalName(eduStaff.getName());
fillUserApprovalProcessRecord.setSort(i);
coreApplyFormFillUserApprovalProcessRecordService.save(fillUserApprovalProcessRecord);
// 发送审核信息
if (i == 0) {
sendStaffNoticeDTO.setStaffWxId(eduStaff.getWxId());
sendStaffNoticeDTO.setStaffName(eduStaff.getName());
sendNoticeService.sendStaffNotice(sendStaffNoticeDTO, 1);
}
}
}
}
}
}
}
}
@@ -0,0 +1,64 @@
package com.yida.data.form.apply.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcessUser;
import com.yida.data.customForm.vo.apply.ApplyFormProcessSelectVO;
import com.yida.data.form.apply.mapper.CoreApplyFormApprovalProcessMapper;
import com.yida.data.form.apply.service.CoreApplyFormApprovalProcessService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormApprovalProcess;
import com.yida.data.form.apply.service.CoreApprovalProcessUserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
* 申请表单对应的审核流程 Service
*
* @author ZYJ
* @date 2023/11/21
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormApprovalProcessServiceImpl extends ServiceImpl<CoreApplyFormApprovalProcessMapper, CoreApplyFormApprovalProcess>
implements CoreApplyFormApprovalProcessService {
private final CoreApprovalProcessUserService coreApprovalProcessUserService;
@Override
public void saveApplyFormApprovalProcess(Long applyFormId, List<CoreApplyFormApprovalProcess> processList) {
// 删除已存在的节点数据
remove(Wrappers.lambdaQuery(new CoreApplyFormApprovalProcess())
.eq(CoreApplyFormApprovalProcess::getApplyFormId, applyFormId));
// 保存信息
for (int i = 0; i < processList.size(); i++) {
CoreApplyFormApprovalProcess process = processList.get(i);
// 处理排序
process.setSort(i);
save(process);
}
}
@Override
public List<ApplyFormProcessSelectVO> listFormApprovalProcess(Long formId) {
List<ApplyFormProcessSelectVO> list = baseMapper.listFormApprovalProcess(formId);
// 处理审核人员信息
list.forEach(vo -> {
List<CoreApprovalProcessUser> processUserList = coreApprovalProcessUserService.list(Wrappers.lambdaQuery(new CoreApprovalProcessUser())
.eq(CoreApprovalProcessUser::getProcessId, vo.getApprovalProcessId()));
if (CollUtil.isNotEmpty(processUserList)) {
String names = processUserList.stream().map(CoreApprovalProcessUser::getName).collect(Collectors.joining(""));
vo.setApprovalUserName(names);
}
});
return list;
}
}
@@ -0,0 +1,25 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.form.apply.mapper.CoreApplyFormFillUserApprovalProcessRecordMapper;
import com.yida.data.form.apply.service.CoreApplyFormFillUserApprovalProcessRecordService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUserApprovalProcessRecord;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 填报用户表单审核流程记录表(具体的审核信息) Service
*
* @author ZYJ
* @date 2023/11/24
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormFillUserApprovalProcessRecordServiceImpl
extends ServiceImpl<CoreApplyFormFillUserApprovalProcessRecordMapper, CoreApplyFormFillUserApprovalProcessRecord>
implements CoreApplyFormFillUserApprovalProcessRecordService {
}
@@ -0,0 +1,25 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.form.apply.mapper.CoreApplyFormFillUserApprovalProcessMapper;
import com.yida.data.form.apply.service.CoreApplyFormFillUserApprovalProcessService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUserApprovalProcess;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 表单填报用户对应审核流程表 Service
*
* @author ZYJ
* @date 2023/11/24
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormFillUserApprovalProcessServiceImpl
extends ServiceImpl<CoreApplyFormFillUserApprovalProcessMapper, CoreApplyFormFillUserApprovalProcess>
implements CoreApplyFormFillUserApprovalProcessService {
}
@@ -0,0 +1,47 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.customForm.dto.apply.ApplyFormFillSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormFillSelectPageVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import com.yida.data.form.apply.mapper.CoreApplyFormFillUserMapper;
import com.yida.data.form.apply.service.CoreApplyFormFillUserService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUser;
import com.yida.data.customForm.dto.apply.H5ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.MyApplyFormPageVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 申请表单填报用户信息表 Service
*
* @author ZYJ
* @date 2023/11/22
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormFillUserServiceImpl extends ServiceImpl<CoreApplyFormFillUserMapper, CoreApplyFormFillUser>
implements CoreApplyFormFillUserService {
@Override
public IPage<MyApplyFormPageVO> selectUserFillForm(H5ApplyFormSelectPageDTO dto, List<Long> userIds) {
return baseMapper.selectUserFillForm(dto.toPage(), dto, userIds);
}
@Override
public IPage<ApplyFormFillSelectPageVO> listApplyFormFillPage(ApplyFormFillSelectPageDTO dto) {
// TODO: 2023/12/7 此处暂时只有学校角色
dto.setDeptId(FebsUtil.getDeptId());
IPage<ApplyFormFillSelectPageVO> page = baseMapper.listApplyFormFillPage(dto.toPage(), dto);
page.getRecords().forEach(vo -> {
// 处理部门数据
});
return page;
}
}
@@ -0,0 +1,23 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.form.apply.service.CoreApplyFormItemChildrenService;
import com.yida.data.form.apply.mapper.CoreApplyFormItemChildrenMapper;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormItemChildren;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 申请类型表单组件选项 Service
*
* @author ZYJ
* @date 2023/11/14 19:17
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormItemChildrenServiceImpl extends ServiceImpl<CoreApplyFormItemChildrenMapper, CoreApplyFormItemChildren>
implements CoreApplyFormItemChildrenService {
}
@@ -0,0 +1,25 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.form.apply.mapper.CoreApplyFormItemMapper;
import com.yida.data.form.apply.service.CoreApplyFormItemService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormItem;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 申请类型表单组件 Service
*
* @author ZYJ
* @date 2023/11/14 19:17
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormItemServiceImpl extends ServiceImpl<CoreApplyFormItemMapper, CoreApplyFormItem>
implements CoreApplyFormItemService {
}
@@ -0,0 +1,188 @@
package com.yida.data.form.apply.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.applyForm.*;
import com.yida.data.common.core.enums.EnableStatusEnum;
import com.yida.data.common.core.exception.FebsException;
import com.yida.data.form.apply.service.*;
import com.yida.data.form.apply.mapper.CoreApplyFormMapper;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.customForm.dto.apply.ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormInfoVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
/**
* 申请类型表单 Service
*
* @author ZYJ
* @date 2023/11/14
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormServiceImpl extends ServiceImpl<CoreApplyFormMapper, CoreApplyForm>
implements CoreApplyFormService {
private final CoreApplyFormItemService coreApplyFormItemService;
private final CoreApplyFormFillUserService coreApplyFormFillUserService;
private final CoreApplyFormItemChildrenService coreApplyFormItemChildrenService;
private final CoreApplyFormApprovalProcessService coreApplyFormApprovalProcessService;
public static final String BASE_APPLY_TABLE_NAME = "core_apply_form_data_z_";
@Override
public IPage<ApplyFormSelectPageVO> listApplyFormPage(ApplyFormSelectPageDTO dto) {
// TODO: 2023/11/14 此处暂时只有学校角色
dto.setDeptId(FebsUtil.getDeptId());
IPage<ApplyFormSelectPageVO> page = baseMapper.listApplyFormPage(dto.toPage(), dto);
page.getRecords().forEach(form ->
form.setSubmitNum(
coreApplyFormFillUserService.count(Wrappers.lambdaQuery(new CoreApplyFormFillUser())
.eq(CoreApplyFormFillUser::getApplyFormId, form.getId()))
));
return page;
}
@Override
public ApplyFormInfoVO getApplyFormInfo(Long id) {
// 返回数据
ApplyFormInfoVO vo = new ApplyFormInfoVO();
CoreApplyForm applyForm = getById(id);
if (Objects.nonNull(applyForm)) {
BeanUtils.copyProperties(applyForm, vo);
// 查询组件信息
List<CoreApplyFormItem> itemList = coreApplyFormItemService.list(Wrappers.<CoreApplyFormItem>query().lambda()
.eq(CoreApplyFormItem::getFormId, id));
itemList.forEach(item -> {
// 查询组件选项信息
List<CoreApplyFormItemChildren> childrenList =
coreApplyFormItemChildrenService.list(Wrappers.<CoreApplyFormItemChildren>query().lambda()
.eq(CoreApplyFormItemChildren::getFormItemId, item.getId()));
item.setChildrenList(childrenList);
});
vo.setItemList(itemList);
}
return vo;
}
@Override
public void deleteApplyForm(Long id) {
CoreApplyForm applyForm = getById(id);
// 判断是否有填报数据
long count = coreApplyFormFillUserService.count(Wrappers.lambdaQuery(new CoreApplyFormFillUser())
.eq(CoreApplyFormFillUser::getApplyFormId, id));
if (count > 0) {
throw new FebsException("当前表单已有填报数据,无法删除!");
}
// 删除申请表信息
removeById(id);
// 删除数据表信息
String dropTableSql = "DROP TABLE IF EXISTS `" + applyForm.getTableName() + "`; \n";
baseMapper.initSqlReturnVoid(dropTableSql);
// 删除附表信息
coreApplyFormItemService.remove(Wrappers.lambdaQuery(new CoreApplyFormItem())
.eq(CoreApplyFormItem::getFormId, id));
coreApplyFormItemChildrenService.remove(Wrappers.lambdaQuery(new CoreApplyFormItemChildren())
.eq(CoreApplyFormItemChildren::getFormId, id));
}
@Override
public Long saveApplyForm(CoreApplyForm applyForm) {
String tableName = BASE_APPLY_TABLE_NAME + System.currentTimeMillis();
// 编辑
if (Objects.nonNull(applyForm.getId())) {
// 判断是否有填报数据
long count = coreApplyFormFillUserService.count(Wrappers.lambdaQuery(new CoreApplyFormFillUser())
.eq(CoreApplyFormFillUser::getApplyFormId, applyForm.getId()));
if (count > 0) {
throw new FebsException("当前表单已有填报数据,无法删除!");
}
// 删除附表信息
coreApplyFormItemService.remove(Wrappers.lambdaQuery(new CoreApplyFormItem())
.eq(CoreApplyFormItem::getFormId, applyForm.getId()));
coreApplyFormItemChildrenService.remove(Wrappers.lambdaQuery(new CoreApplyFormItemChildren())
.eq(CoreApplyFormItemChildren::getFormId, applyForm.getId()));
// 删除数据表信息
String dropTableSql = "DROP TABLE IF EXISTS `" + applyForm.getTableName() + "`; \n";
baseMapper.initSqlReturnVoid(dropTableSql);
applyForm.setTableName(tableName);
updateById(applyForm);
} else {
// TODO: 2023/11/15 此处暂时只有学校角色
applyForm.setSchoolId(FebsUtil.getDeptId());
// 对应表名称
applyForm.setTableName(tableName);
save(applyForm);
}
// 保存审核流程节点信息
if (CollUtil.isNotEmpty(applyForm.getProcessList())) {
coreApplyFormApprovalProcessService.saveApplyFormApprovalProcess(applyForm.getId(), applyForm.getProcessList());
}
// 动态生成填报表
StringBuilder stringBuilder = new StringBuilder();
String createTableSql = "CREATE TABLE " + applyForm.getTableName() + "( \n" + "`id` bigint(20) NOT NULL AUTO_INCREMENT,\n";
stringBuilder.append(createTableSql);
// 处理组件数据
applyForm.getItemList().forEach(item -> {
String typeValue;
if ("moreInput".equals(item.getItemType())) {
typeValue = "text";
} else {
typeValue = "varchar(255)";
}
// 添加选项信息
String sql = "`" + item.getItemFiledName() + "` " + typeValue + " DEFAULT NULL COMMENT '" + item.getItemTitle() + "'";
stringBuilder.append(sql).append(",");
// 保存选项信息
item.setId(null);
item.setFormId(applyForm.getId());
coreApplyFormItemService.save(item);
item.getChildrenList().forEach(itemChildren -> {
itemChildren.setId(null);
itemChildren.setFormItemId(item.getId());
itemChildren.setFormId(applyForm.getId());
coreApplyFormItemChildrenService.save(itemChildren);
});
});
// 创建数据表sql
String initSql = stringBuilder +
"`user_id` bigint(20) DEFAULT NULL COMMENT '学生id',\n" +
"`create_date` datetime DEFAULT NULL COMMENT '创建时间',\n" +
"`examine_status` tinyint(1) DEFAULT '0' COMMENT '审核状态:默认0未审核,1已通过,2已拒绝,3审核中',\n" +
"PRIMARY KEY (`id`)\n" +
") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8";
baseMapper.initSqlReturnVoid(initSql);
return applyForm.getId();
}
@Override
public void updateEnableStatus(Long formId, Integer enableStatus) {
if (EnableStatusEnum.ENABLE_STATUS.getStatus().equals(enableStatus)) {
// 判断当前表单是否有流程信息
long count = coreApplyFormApprovalProcessService.count(Wrappers.lambdaQuery(new CoreApplyFormApprovalProcess())
.eq(CoreApplyFormApprovalProcess::getApplyFormId, formId));
if (count == 0) {
throw new FebsException("当前表单暂无审核流程,请添加审核流程后再启用!");
}
}
CoreApplyForm applyForm = new CoreApplyForm();
applyForm.setId(formId);
applyForm.setStatus(enableStatus);
updateById(applyForm);
}
}
@@ -0,0 +1,130 @@
package com.yida.data.form.apply.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormApprovalProcess;
import com.yida.data.form.apply.mapper.CoreApprovalProcessMapper;
import com.yida.data.form.apply.service.CoreApplyFormApprovalProcessService;
import com.yida.data.form.apply.service.CoreApprovalProcessService;
import com.yida.data.form.apply.service.CoreApprovalProcessUserService;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcess;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcessUser;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.customForm.dto.apply.ApprovalProcessSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApprovalProcessInfoVO;
import com.yida.data.customForm.vo.apply.ApprovalProcessSelectPageVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 审核流程表 Service
*
* @author ZYJ
* @date 2023/11/21
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CoreApprovalProcessServiceImpl extends ServiceImpl<CoreApprovalProcessMapper, CoreApprovalProcess>
implements CoreApprovalProcessService {
private final CoreApprovalProcessUserService coreApprovalProcessUserService;
private final CoreApplyFormApprovalProcessService coreApplyFormApprovalProcessService;
@Override
public IPage<ApprovalProcessSelectPageVO> listApprovalProcessPage(ApprovalProcessSelectPageDTO dto) {
// TODO: 2023/11/21 此处暂时只有学校角色
dto.setDeptId(FebsUtil.getDeptId());
IPage<ApprovalProcessSelectPageVO> page = baseMapper.listApprovalProcessPage(dto.toPage(), dto);
// TODO: 2023/11/21 后续查询关键字段
if (CollUtil.isNotEmpty(page.getRecords())) {
page.getRecords().forEach(process -> {
// 查询审核人员名称
List<CoreApprovalProcessUser> processUserList = coreApprovalProcessUserService.list(Wrappers.lambdaQuery(new CoreApprovalProcessUser())
.eq(CoreApprovalProcessUser::getProcessId, process.getId()));
if (CollUtil.isNotEmpty(processUserList)) {
String names = processUserList.stream().map(CoreApprovalProcessUser::getName).collect(Collectors.joining(""));
process.setApprovalUserName(names);
}
});
}
return page;
}
@Override
public ApprovalProcessInfoVO getApprovalProcessInfo(Long id) {
// 返回数据
ApprovalProcessInfoVO vo = new ApprovalProcessInfoVO();
CoreApprovalProcess process = getById(id);
if (Objects.nonNull(process)) {
BeanUtils.copyProperties(process, vo);
// 查询人员信息
List<CoreApprovalProcessUser> list = coreApprovalProcessUserService.list(Wrappers.lambdaQuery(new CoreApprovalProcessUser())
.eq(CoreApprovalProcessUser::getProcessId, id));
vo.setUserList(list);
}
return vo;
}
@Override
public void deleteApprovalProcess(Long id) {
removeById(id);
// 删除关联用户
coreApprovalProcessUserService.remove(Wrappers.lambdaQuery(new CoreApprovalProcessUser())
.eq(CoreApprovalProcessUser::getProcessId, id));
// TODO: 2023/11/21 删除申请表单对应的审核流程信息 (此处需要判断能否删除)
}
@Override
public void saveApprovalProcess(CoreApprovalProcess process) {
// TODO: 2023/11/21 需要判断能否修改
if (Objects.nonNull(process.getId())) {
// 删除用户信息
coreApprovalProcessUserService.remove(Wrappers.lambdaQuery(new CoreApprovalProcessUser())
.eq(CoreApprovalProcessUser::getProcessId, process.getId()));
} else {
process.setDeptId(FebsUtil.getDeptId());
}
saveOrUpdate(process);
// 处理用户信息
if (CollUtil.isNotEmpty(process.getUserList())) {
for (CoreApprovalProcessUser coreApprovalProcessUser : process.getUserList()) {
coreApprovalProcessUser.setId(null);
coreApprovalProcessUser.setProcessId(process.getId());
coreApprovalProcessUserService.save(coreApprovalProcessUser);
}
}
}
@Override
public List<CoreApprovalProcess> listApprovalProcess(Long formId) {
// 查询表单已有的流程
List<CoreApplyFormApprovalProcess> list = coreApplyFormApprovalProcessService.list(Wrappers.lambdaQuery(new CoreApplyFormApprovalProcess())
.eq(CoreApplyFormApprovalProcess::getApplyFormId, formId));
List<CoreApprovalProcess> processList = list(Wrappers.lambdaQuery(new CoreApprovalProcess())
.notIn(CollUtil.isNotEmpty(list), CoreApprovalProcess::getId, list.stream()
.map(CoreApplyFormApprovalProcess::getApprovalProcessId).collect(Collectors.toList())));
if (CollUtil.isNotEmpty(processList)) {
processList.forEach(process -> {
// 查询审核人员名称
List<CoreApprovalProcessUser> processUserList = coreApprovalProcessUserService.list(Wrappers.lambdaQuery(new CoreApprovalProcessUser())
.eq(CoreApprovalProcessUser::getProcessId, process.getId()));
if (CollUtil.isNotEmpty(processUserList)) {
String names = processUserList.stream().map(CoreApprovalProcessUser::getName).collect(Collectors.joining(""));
process.setApprovalUserName(names);
}
});
}
return processList;
}
}
@@ -0,0 +1,25 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.form.apply.mapper.CoreApprovalProcessUserMapper;
import com.yida.data.form.apply.service.CoreApprovalProcessUserService;
import com.yida.data.common.core.entity.applyForm.CoreApprovalProcessUser;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 审核流程人员配置表 Service
*
* @author ZYJ
* @date 2023/11/21
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CoreApprovalProcessUserServiceImpl extends ServiceImpl<CoreApprovalProcessUserMapper, CoreApprovalProcessUser>
implements CoreApprovalProcessUserService {
}
@@ -0,0 +1,55 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.customForm.dto.apply.ApprovalRemindDTO;
import com.yida.data.customForm.vo.apply.ApprovalProcessInfoVO;
import com.yida.data.customForm.vo.apply.ApprovalRemindInfoVO;
import com.yida.data.form.apply.mapper.CoreApprovalRemindMapper;
import com.yida.data.form.apply.service.CoreApprovalRemindService;
import com.yida.data.common.core.entity.applyForm.CoreApprovalRemind;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/**
* 审核提醒策略表 Service
*
* @author ZYJ
* @date 2023/11/23
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class CoreApprovalRemindServiceImpl extends ServiceImpl<CoreApprovalRemindMapper, CoreApprovalRemind>
implements CoreApprovalRemindService {
@Override
public ApprovalRemindInfoVO getApprovalRemindInfo() {
// 返回信息
ApprovalRemindInfoVO vo = new ApprovalRemindInfoVO();
CoreApprovalRemind approvalRemind = getOne(Wrappers.lambdaQuery(new CoreApprovalRemind())
.eq(CoreApprovalRemind::getDeptId, FebsUtil.getDeptId()));
if (Objects.nonNull(approvalRemind)) {
BeanUtils.copyProperties(approvalRemind, vo);
}
return vo;
}
@Override
public void saveApprovalRemind(ApprovalRemindDTO dto) {
CoreApprovalRemind approvalRemind = getOne(Wrappers.lambdaQuery(new CoreApprovalRemind())
.eq(CoreApprovalRemind::getDeptId, FebsUtil.getDeptId()));
if (Objects.isNull(approvalRemind)) {
approvalRemind = new CoreApprovalRemind();
approvalRemind.setDeptId(FebsUtil.getDeptId());
}
approvalRemind.setApprovalRemindStatus(dto.getApprovalRemindStatus());
approvalRemind.setApprovalResultStatus(dto.getApprovalResultStatus());
saveOrUpdate(approvalRemind);
}
}
@@ -0,0 +1,75 @@
package com.yida.data.form.apply.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.form.apply.mapper.CoreOfficialSealMapper;
import com.yida.data.form.apply.service.CoreOfficialSealService;
import com.yida.data.common.core.entity.applyForm.CoreOfficialSeal;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.customForm.dto.apply.OfficialSealSaveDTO;
import com.yida.data.customForm.dto.apply.OfficialSealSelectPageDTO;
import com.yida.data.customForm.vo.apply.OfficialSealInfoVO;
import com.yida.data.customForm.vo.apply.OfficialSealSelectPageVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/**
* 学校公章 Service
*
* @author ZYJ
* @date 2023/11/17
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CoreOfficialSealServiceImpl extends ServiceImpl<CoreOfficialSealMapper, CoreOfficialSeal>
implements CoreOfficialSealService {
@Override
public IPage<OfficialSealSelectPageVO> listOfficialSealPage(OfficialSealSelectPageDTO dto) {
// TODO: 2023/11/17 此处暂时只有学校角色
dto.setDeptId(FebsUtil.getDeptId());
// TODO: 2023/11/17 需要查询对应的审核流程
return baseMapper.listOfficialSealPage(dto.toPage(), dto);
}
@Override
public OfficialSealInfoVO getOfficialSealInfo(Long id) {
CoreOfficialSeal officialSeal = getById(id);
// 返回数据
OfficialSealInfoVO vo = new OfficialSealInfoVO();
if (Objects.nonNull(officialSeal)) {
BeanUtils.copyProperties(officialSeal, vo);
}
return vo;
}
@Override
public void deleteOfficialSeal(Long id) {
// TODO: 2023/11/17 需要判断能否删除
removeById(id);
}
@Override
public void saveOfficialSeal(OfficialSealSaveDTO dto) {
// TODO: 2023/11/17 此处暂时只有学校角色
CoreOfficialSeal coreOfficialSeal = new CoreOfficialSeal();
BeanUtils.copyProperties(dto, coreOfficialSeal);
coreOfficialSeal.setDeptId(FebsUtil.getDeptId());
saveOrUpdate(coreOfficialSeal);
}
@Override
public void updateEnableStatus(Long id, Integer enableStatus) {
CoreOfficialSeal coreOfficialSeal = new CoreOfficialSeal();
coreOfficialSeal.setId(id);
coreOfficialSeal.setStatus(enableStatus);
updateById(coreOfficialSeal);
}
}
@@ -0,0 +1,168 @@
package com.yida.data.form.apply.service.impl;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.entity.applyForm.CoreApprovalRemind;
import com.yida.data.common.core.entity.constant.AppConstant;
import com.yida.data.common.core.entity.constant.NoticeTypeConstant;
import com.yida.data.common.core.entity.notice.qywx.TemplateCardStaffNotice;
import com.yida.data.common.core.entity.notice.qywx.TextSchoolNotice;
import com.yida.data.common.core.entity.notice.qywx.inside.TemplateCardNotice;
import com.yida.data.common.core.entity.notice.qywx.inside.Text;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.CardAction;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.HorizontalContent;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.Jump;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.MainTitle;
import com.yida.data.common.core.entity.system.Dept;
import com.yida.data.common.core.entity.system.EduApp;
import com.yida.data.common.core.entity.user.EduStudent;
import com.yida.data.common.core.enums.EnableStatusEnum;
import com.yida.data.common.core.enums.leave.ApprovalResultEnum;
import com.yida.data.common.core.utils.WxUtil;
import com.yida.data.common.service.CommonService;
import com.yida.data.customForm.dto.apply.SendParentNoticeDTO;
import com.yida.data.customForm.dto.apply.SendStaffNoticeDTO;
import com.yida.data.form.apply.service.CoreApprovalRemindService;
import com.yida.data.form.apply.service.SendNoticeService;
import com.yida.data.user.feign.RemoteStudentService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* 发送消息 Service
*
* @author ZYJ
* @date 2023/11/30
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class SendNoticeServiceImpl implements SendNoticeService {
private final CoreApprovalRemindService coreApprovalRemindService;
private final RemoteStudentService remoteStudentService;
private final WxUtil wxUtil;
private final CommonService commonService;
@Value("${febs.parentFormNoticeUrl}")
private String parentFormNoticeUrl;
@Value("${febs.teacherFormNoticeUrl}")
private String teacherFormNoticeUrl;
@Override
public void sendStaffNotice(SendStaffNoticeDTO dto, Integer isFirst) {
// 需要判断是否要推送消息
CoreApprovalRemind approvalRemind = coreApprovalRemindService.getOne(Wrappers.lambdaQuery(new CoreApprovalRemind())
.eq(CoreApprovalRemind::getDeptId, dto.getSchoolId()));
if (Objects.nonNull(approvalRemind)
&& EnableStatusEnum.ENABLE_STATUS.getStatus().equals(approvalRemind.getApprovalRemindStatus())) {
// 企业微信推送消息
if (dto.getSchoolType().contains(Dept.TYPE_QYWX)) {
// 查询推送消息的应用信息
EduApp app = commonService.getAppByCodeAndSchool(AppConstant.CONTACT_SELECT, null,
dto.getSchoolId());
String accessToken = wxUtil.getAccessToken(app.getWxCorpId(), app.getWxSecret());
// 跳转职工审核页面
String url = String
.format("%s?corpId=%s&schoolId=%s&userType=%s&formId=%s&fillUserId=%s&userId=%s&currentUserStatus=%s", teacherFormNoticeUrl,
app.getWxCorpId(),
dto.getSchoolId(), 0, dto.getFormId(), dto.getFillUserId(), dto.getUserId(), 0);
log.error("申请表单职工url: {}", url);
// 模板卡片消息--文本通知型
TemplateCardNotice templateCardNotice = new TemplateCardNotice();
templateCardNotice.setCard_type(NoticeTypeConstant.TEMPLATE_NOTICE_TYPE_TEXT);
templateCardNotice.setMain_title(MainTitle.builder().title("学生申请提醒").build());
// 是否为初次审核
if (isFirst == 1) {
// 初次审核
templateCardNotice
.setSub_title_text(String.format("尊敬的%s老师,%S同学于%S提交的申请信息,等待您的审批!",
dto.getStaffName(), dto.getUserName(),
LocalDateTimeUtil.format(dto.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
} else {
// 非初次审核
templateCardNotice
.setSub_title_text(String.format("尊敬的%s老师,你好!%S老师【%S】已同意%S同学于%S提交的申请信息,等待您的审批!",
dto.getStaffName(), dto.getPreStaffName(), dto.getPreStaffRoleName(), dto.getUserName(),
LocalDateTimeUtil.format(dto.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
}
List<HorizontalContent> horizontalContentList = new ArrayList<>();
horizontalContentList
.add(HorizontalContent.builder().keyname("班级").value(dto.getUserDeptName()).build());
horizontalContentList
.add(HorizontalContent.builder().keyname("学生").value(dto.getUserName()).build());
horizontalContentList.add(HorizontalContent.builder().keyname("申请时间")
.value(LocalDateTimeUtil.format(dto.getCreateTime(), "yyyy-MM-dd HH:mm")).build());
templateCardNotice.setHorizontal_content_list(horizontalContentList);
templateCardNotice.setCard_action(CardAction.builder().type(1).url(url).build());
templateCardNotice
.setJump_list(Collections.singletonList(Jump.builder().type(1).title("点击查看详情并处理").url(url).build()));
TemplateCardStaffNotice templateCardStaffNotice = new TemplateCardStaffNotice();
templateCardStaffNotice.setTouser(dto.getStaffWxId());
templateCardStaffNotice.setAgentid(app.getWxAgentId());
templateCardStaffNotice.setTemplate_card(templateCardNotice);
// 发送企业微信通知
wxUtil.pushStaffNotice(accessToken, templateCardStaffNotice);
}
}
}
@Override
public void sendParentNotice(SendParentNoticeDTO dto) {
// 学校信息
Dept school = dto.getSchool();
// 学生信息
EduStudent student = dto.getStudent();
// 需要判断是否要推送消息
CoreApprovalRemind approvalRemind = coreApprovalRemindService.getOne(Wrappers.lambdaQuery(new CoreApprovalRemind())
.eq(CoreApprovalRemind::getDeptId, school.getDeptId()));
if (Objects.nonNull(approvalRemind)
&& EnableStatusEnum.ENABLE_STATUS.getStatus().equals(approvalRemind.getApprovalResultStatus())) {
// 企业微信推送消息
if (school.getSchoolType().contains(Dept.TYPE_QYWX)) {
TextSchoolNotice textSchoolNotice = new TextSchoolNotice();
// 查询推送消息的应用信息
EduApp appByCodeAndSchool = commonService.getAppByCodeAndSchool(AppConstant.INDEX_PARENT, null, school.getDeptId());
// 查询家长id集合
List<String> parentId = remoteStudentService.findParentWxId(Collections.singletonList(student.getId())).getData();
Text text = new Text();
textSchoolNotice.setText(text);
textSchoolNotice.setAgentid(appByCodeAndSchool.getWxAgentId());
// 跳转学生填报详情页面
String url = String
.format("%s?corpId=%s&schoolId=%s&userType=%s&formId=%s&fillUserId=%s&userId=%s", parentFormNoticeUrl,
appByCodeAndSchool.getWxCorpId(),
school.getDeptId(), 1, dto.getFormId(), dto.getFillUserId(), dto.getStudent().getId());
String msg = ObjectUtil.equals(ApprovalResultEnum.AUDIT_PASS.getResult(), dto.getExamineStatus()) ? "已通过" : "未通过";
text.setContent(
"<a href='" + url + "'>" + student.getStuName() + "同学于" +
LocalDateTimeUtil.format(dto.getCreateTime(), "yyyy-MM-dd HH:mm:ss")
+ "的申请" + msg + ",点击可查看详情" + "</a>");
textSchoolNotice.setTo_parent_userid(parentId);
// 发送信息
String accessToken = wxUtil.getAccessToken(appByCodeAndSchool.getWxCorpId(), appByCodeAndSchool.getWxSecret());
wxUtil.pushSchoolNotice(accessToken, textSchoolNotice);
}
}
}
}
@@ -0,0 +1,53 @@
package com.yida.data.form.customForm.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuth;
import com.yida.data.form.customForm.service.CoreCustomFormAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 表单对应管理员权限表 Controller
*
* @author ccl
* @date 2021-11-05 15:41:13
*/
@Api(tags = "后台--表单权限")
@Slf4j
@Validated
@RestController
@RequestMapping("coreCustomFormAuth")
@RequiredArgsConstructor
public class CoreCustomFormAuthController {
private final CoreCustomFormAuthService coreCustomFormAuthService;
@ApiOperation("新增或修改表单基本权限")
@PostMapping("saveOrUpdateFormAuth")
public ResultBean saveOrUpdateFormAuth (@RequestBody CoreCustomFormAuth formAuth){
coreCustomFormAuthService.saveOrUpdate(formAuth);
return ResultBean.buildSuccess();
}
@ApiOperation("批量删除表单基本权限")
@PostMapping("delFormAuth")
public ResultBean delFormAuth (@RequestBody List<Long> authIds){
coreCustomFormAuthService.removeByIds(authIds);
return ResultBean.buildSuccess();
}
@ApiOperation("查询权限列表")
@GetMapping("findFormAuthList")
public ResultBean<List<CoreCustomFormAuth>> findFormAuthList (){
return ResultBean.buildSuccess(coreCustomFormAuthService.list());
}
}
@@ -0,0 +1,123 @@
package com.yida.data.form.customForm.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.form.customForm.service.CoreCustomFormItemChildrenService;
import com.yida.data.form.customForm.service.CoreCustomFormItemsService;
import com.yida.data.form.customForm.service.CoreCustomFormService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 自定义表单 Controller
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/coreCustomForm")
@RequiredArgsConstructor
@Api(tags = "后台--表单管理")
public class CoreCustomFormController {
private final CoreCustomFormService coreCustomFormService;
private final CoreCustomFormItemsService coreCustomFormItemsService;
private final CoreCustomFormItemChildrenService coreCustomFormItemChildrenService;
/***
* @Author jianMingWang
* @Description //查询所有表单
* @Date 14:33 2021/8/9
* @Param [schoolId]
* @return com.liuliu.data.custom.entity.ResultBean<java.util.List < com.liuliu.data.custom.entity.CoreCustomFormType>>
**/
@ApiOperation("表单分页查询")
@GetMapping("/findList")
public ResultBean<IPage<CoreCustomForm>> fondType(@ApiParam(value = "学校ID", required = true, type = "Long") Long schoolId,
@ApiParam(value = "表单类型ID", required = true, type = "Long") Long formTypeId,
@ApiParam(value = "是否为模板:1=是,0=否", required = false, type = "String") @RequestParam(value = "model", required = false) String model,
@ApiParam(value = "当前页码", required = false, defaultValue = "1", type = "Integer") @RequestParam(defaultValue = "1") Integer pageNum,
@ApiParam(value = "页面大小", required = false, defaultValue = "10", type = "Integer") @RequestParam(defaultValue = "10") Integer pageSize) {
IPage<CoreCustomForm> customFormPageList = coreCustomFormService.findCustomFormPageList(new Page(pageNum, pageSize),
schoolId, formTypeId, model, FebsUtil.getCurrentUser());
return ResultBean.buildSuccess(customFormPageList);
}
/***
* @Author jianMingWang
* @Description //获取当前表单
* @Date 11:22 2021/8/10
* @Param [schoolId, formTypeId]
* @return com.liuliu.data.custom.entity.ResultBean<com.liuliu.data.custom.entity.CoreCustomForm>
**/
@ApiOperation("表单详情")
@GetMapping("/findById")
public ResultBean<CoreCustomForm> findById(@ApiParam(value = "主键ID", required = true, type = "Long") Long id) {
return ResultBean.buildSuccess(coreCustomFormService.findById(id));
}
/***
* @Author jianMingWang
* @Description //删除表单
* @Date 14:29 2021/8/9
* @Param [coreCustomForm]
* @return com.liuliu.data.custom.entity.ResultBean
**/
@ApiOperation("删除表单")
@GetMapping("/delForm")
public ResultBean delForm(@ApiParam(value = "主键ID", required = true, type = "Long") Long formId) {
coreCustomFormService.delForm(formId);
//删除表单对应附表
return ResultBean.buildSuccess();
}
/***
* @Author jianMingWang
* @Description 创建、编辑表单
* @Date 14:29 2021/8/9
* @Param [coreCustomForm]
* @return com.liuliu.data.custom.entity.ResultBean
**/
@ApiOperation("创建表单")
@PostMapping("/createForm")
public ResultBean createForm(@RequestBody CoreCustomForm dto) throws Exception {
Integer state = coreCustomFormService.saveForm(dto);
if (state==1){
return ResultBean.buildError("已发布的表不能修改");
}
return ResultBean.buildSuccess();
}
@ApiOperation("表单发布")
@GetMapping("/publishForm")
public ResultBean publishForm(@RequestParam Long formId,@ApiParam("1为发布,2为取消发布")@RequestParam Integer status) {
CoreCustomForm byId = coreCustomFormService.getById(formId);
byId.setStatus(status);
coreCustomFormService.publishForm(byId);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,154 @@
package com.yida.data.form.customForm.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.*;
import com.yida.data.customForm.dto.RemindAgainDTO;
import com.yida.data.form.customForm.entity.FormDataReturn;
import com.yida.data.form.customForm.service.CoreCustomFormDataService;
import com.yida.data.form.customForm.service.CoreCustomFormItemChildrenService;
import com.yida.data.form.customForm.service.CoreCustomFormItemsService;
import com.yida.data.form.customForm.service.CoreCustomFormService;
import com.yida.data.customForm.vo.CommitUserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @ClassName CoreCustomFormDataController
* @Author jianMingWang
* @Date 2021/8/12 16:54
* @Version 1.0
**/
@Slf4j
@Validated
@RestController
@RequestMapping("/coreCustomFormData")
@RequiredArgsConstructor
@Api(tags = "后台--表单数据相关")
public class CoreCustomFormDataController {
@Autowired
private CoreCustomFormDataService coreCustomFormDataService;
@Autowired
private CoreCustomFormService coreCustomFormService;
@Autowired
private CoreCustomFormItemsService coreCustomFormItemsService;
@Autowired
private CoreCustomFormItemChildrenService coreCustomFormItemChildrenService;
/***
* @Author jianMingWang
* @Description //列表分页查看当前表单数据
* @Date 17:33 2021/9/16
* @Param []
* @return com.yida.data.common.core.common.ResultBean<java.util.HashMap>
**/
@ApiOperation("列表分页查询当前表单数据")
@GetMapping("/findSubmitFromDataListByFormId")
public ResultBean<FormDataReturn> findSubmitFromDataListByFormId(@ApiParam(required = true, value = "表单主键ID") @RequestParam Integer formId,
@ApiParam(required = true, value = "每页条数") @RequestParam(required = true, defaultValue = "10") Integer pageSize,
@ApiParam(required = true, value = "页码") @RequestParam(required = true, defaultValue = "1") Integer pageNo) {
return ResultBean.buildSuccess(coreCustomFormDataService.findList(formId, pageSize, pageNo));
}
/***
* @Author jianMingWang
* @Description //导出excel数据
* @Date 16:40 2021/9/17
* @return com.yida.data.common.core.common.ResultBean<com.yida.data.customForm.entity.FormDataReturn>
**/
@GetMapping("/exportData")
@ApiOperation("导出表单数据")
public void exportData(@ApiParam(value = "表单主键ID", required = true) @RequestParam Integer formId, HttpServletResponse response) {
try {
coreCustomFormDataService.exportData(formId, response);
} catch (Exception e) {
e.printStackTrace();
}
}
/***
* @Author jianMingWang
* @Description //获取当前表单
* @Date 11:22 2021/8/10
* @Param [schoolId, formTypeId]
* @return com.liuliu.data.custom.entity.ResultBean<com.liuliu.data.custom.entity.CoreCustomForm>
**/
@ApiOperation("表单详情")
@GetMapping("/findById")
public ResultBean<CoreCustomForm> findById(@ApiParam(value = "主键ID", required = true, type = "Long") Long id) {
CoreCustomForm coreCustomForm = coreCustomFormService.getById(id);
List<CoreCustomFormItems> coreCustomFormItemList = coreCustomFormItemsService.list(Wrappers.<CoreCustomFormItems>query().lambda().eq(CoreCustomFormItems::getFormId, id));
coreCustomFormItemList.forEach(coreCustomFormItems -> {
List<CoreCustomFormItemChildren> coreCustomFormItemChildrenlist = coreCustomFormItemChildrenService.list(Wrappers.<CoreCustomFormItemChildren>query().lambda().eq(CoreCustomFormItemChildren::getFormItemId, coreCustomFormItems.getId()));
coreCustomFormItems.setCoreCustomFormItemChildrenList(coreCustomFormItemChildrenlist);
});
coreCustomForm.setCoreCustomFormItemsList(coreCustomFormItemList);
return ResultBean.buildSuccess(coreCustomForm);
}
@GetMapping("commitUser")
@ApiOperation("表单人员列表查询")
public ResultBean<CommitUserVO> commitUser(@ApiParam("表单id") @RequestParam Long formId,
@ApiParam("未提交为0,已提交为1") @RequestParam Integer type,
@ApiParam("名字") @RequestParam(required = false) String name,
@RequestParam(defaultValue = "1") Long pageNum,
@RequestParam(defaultValue = "10") Long pageSize) {
Page<CoreCustomFormRelationUser> page = new Page<>();
page.setCurrent(pageNum);
page.setSize(pageSize);
return ResultBean.buildSuccess(coreCustomFormService.commitUser(formId,type,name,page));
}
@GetMapping("findCommitUser")
@ApiOperation("已提交人员列表查询")
public ResultBean<Page> findCommitUser(@ApiParam("表单id") @RequestParam Long formId,
@ApiParam("0为未提交,1为已提交") @RequestParam(required = false) Integer fillType,
@RequestParam(defaultValue = "1") Long pageNum,
@RequestParam(defaultValue = "10") Long pageSize) {
Page page = new Page<>();
page.setCurrent(pageNum);
page.setSize(pageSize);
return ResultBean.buildSuccess(coreCustomFormService.findCommitUser(formId, fillType, page));
}
@GetMapping("findStatistic")
@ApiOperation("查询统计数据")
public ResultBean<CoreCustomFormStatistic> findStatistic(@ApiParam("表单id") @RequestParam Long formId) {
return ResultBean.buildSuccess(coreCustomFormService.findStatistic(formId));
}
@PostMapping("remindAgain")
@ApiOperation("未提交人员再次提醒")
public ResultBean remindAgain(@RequestBody RemindAgainDTO dto) {
coreCustomFormService.remindAgain(dto);
return ResultBean.buildSuccess();
}
@ApiOperation("导出已提交、未提交人员")
@GetMapping("/exportUserListInOut")
public void exportUserListInOut(@ApiParam("表单id") @RequestParam Long formId, @ApiParam("1为已提交,0为未提交") @RequestParam Integer status, HttpServletResponse response) {
coreCustomFormService.exportUserListInOut(formId, status, response);
}
}
@@ -0,0 +1,71 @@
package com.yida.data.form.customForm.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import com.yida.data.common.core.entity.customform.CoreCustomFormGroup;
import com.yida.data.form.customForm.service.CoreCustomFormGroupService;
import com.yida.data.form.customForm.service.CoreCustomFormService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 表单组 Controller
*
* @author ccl
* @date 2021-11-05 15:41:03
*/
@Slf4j
@Validated
@RestController
@RequestMapping("coreCustomFormGroup")
@RequiredArgsConstructor
@Api(tags = "后台--表单分组")
public class CoreCustomFormGroupController {
private final CoreCustomFormGroupService formGroupService;
private final CoreCustomFormService customFormService;
@GetMapping("findGroupPageList")
@ApiOperation("分页查询表单组")
public ResultBean<Page<CoreCustomFormGroup>> findGroupPageList(@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String groupName){
return ResultBean.buildSuccess(formGroupService.findGroupPageList(pageNum,pageSize,groupName));
}
@PostMapping("saveOrUpdateGroup")
@ApiOperation("新增表单组")
public ResultBean saveOrUpdateGroup(@RequestBody CoreCustomFormGroup formGroup){
formGroupService.saveOrUpdate(formGroup);
return ResultBean.buildSuccess();
}
@PostMapping("removeFormGroup")
@ApiOperation("批量删除表单组")
public ResultBean removeFormGroup(@RequestBody List<Long> ids){
formGroupService.removeByIds(ids);
return ResultBean.buildSuccess();
}
@GetMapping("updateFormGroup")
@ApiOperation("将表单分到表单组")
public ResultBean updateFormGroup(@RequestParam @ApiParam("表单组id") Long id,
@RequestParam @ApiParam("组 id") Long groupId){
CoreCustomForm coreCustomForm = new CoreCustomForm();
coreCustomForm.setId(id);
coreCustomForm.setGroupId(groupId);
customFormService.updateById(coreCustomForm);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,41 @@
package com.yida.data.form.customForm.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.form.customForm.service.CoreCustomFormModelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 自定义表单模板 Controller
*
* @author wjm
* @date 2021-08-30 15:22:15
*/
@Slf4j
@Validated
@RestController
@RequestMapping("formModel")
@RequiredArgsConstructor
@Api(tags = "后台--表单模板管理")
public class CoreCustomFormModelController {
private final CoreCustomFormModelService coreCustomFormModelService;
@GetMapping("/selectFormModel")
@ApiOperation("查询表单模板")
public ResultBean selectFormModel(@RequestParam Long id){
return ResultBean.buildSuccess(coreCustomFormModelService.getById(id));
}
@GetMapping("/delFormModel")
@ApiOperation("删除表单模板")
public ResultBean delFormModel(@RequestParam Long id){
coreCustomFormModelService.removeById(id);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,47 @@
package com.yida.data.form.customForm.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.CoreCustomFormType;
import com.yida.data.form.customForm.service.CoreCustomFormTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 自定义表单类型表 Controller
*
* @author wjm
* @date 2021-08-12 10:56:57
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/coreCustomFormType")
@RequiredArgsConstructor
@Api(tags = "后台--表单类型")
public class CoreCustomFormTypeController {
@Autowired
private final CoreCustomFormTypeService coreCustomFormTypeService;
@ApiOperation("查询自定义表单类型LIST")
@GetMapping("/findList")
public ResultBean<List<CoreCustomFormType>> fondTypeList(){
List<CoreCustomFormType> type = coreCustomFormTypeService.list();
return ResultBean.buildSuccess(type);
}
@ApiOperation("新增表单类型")
@PostMapping("/insertFormType")
public ResultBean insertFormType(@RequestBody CoreCustomFormType coreCustomFormType){
coreCustomFormTypeService.save(coreCustomFormType);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,45 @@
package com.yida.data.form.customForm.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.customForm.dto.RemindAgainDTO;
import com.yida.data.form.customForm.service.CoreCustomFormService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ccl
*/
@Slf4j
@Validated
@RestController
@RequestMapping("in/coreCustomForm")
@RequiredArgsConstructor
@Api(tags = "不鉴权-表单管理")
public class InCoreCustomFormController {
private final CoreCustomFormService coreCustomFormService;
@GetMapping("updateById")
@ApiOperation("修改表单为发布")
public ResultBean updateById(@RequestParam Long id){
coreCustomFormService.updateAndSendNotice(id);
return ResultBean.buildSuccess();
}
@GetMapping("remindLast")
@ApiOperation("距离结束通知")
public ResultBean remindLast(@RequestParam Long id){
RemindAgainDTO dto = new RemindAgainDTO();
dto.setFormId(id);
coreCustomFormService.remindAgain(dto);
return ResultBean.buildSuccess();
}
}
@@ -0,0 +1,145 @@
package com.yida.data.form.customForm.controller.app;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUser;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUserParent;
import com.yida.data.customForm.dto.FormDataInput;
import com.yida.data.form.customForm.service.CoreCustomFormDataService;
import com.yida.data.form.customForm.service.CoreCustomFormRelationUserParentService;
import com.yida.data.form.customForm.service.CoreCustomFormRelationUserService;
import com.yida.data.form.customForm.service.CoreCustomFormService;
import com.yida.data.customForm.vo.FormStudentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author ccl
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/appCustomForm")
@RequiredArgsConstructor
@Api(tags = "app表单--表单管理")
public class AppCustomFormController {
@Resource
private final CoreCustomFormService formService;
@Resource
private final CoreCustomFormDataService coreCustomFormDataService;
@Resource
private final CoreCustomFormRelationUserService userService;
@Resource
private final CoreCustomFormRelationUserParentService parentService;
@GetMapping("appFindFormList")
@ApiOperation("app查询填报列表")
public ResultBean<IPage<CoreCustomForm>> appFindFormList(@ApiParam("用户id") @RequestParam Long userId,
@ApiParam("0为职工,1为学生,2为家长") @RequestParam Integer type,
@ApiParam("学校id") @RequestParam Long schoolId,
@ApiParam("表单名称") @RequestParam(required = false) String tableName,
@ApiParam("表单状态,不传为全查") @RequestParam(required = false) Integer status,
@RequestParam(defaultValue = "10") Long pageSize,
@RequestParam(defaultValue = "1") Long pageNum){
return ResultBean.buildSuccess(formService.appFindFormList(new Page<CoreCustomForm>(pageNum,pageSize),userId,tableName,status,schoolId,type));
}
@GetMapping("appFindAdminFormList")
@ApiOperation("app查询管理列表列表")
public ResultBean<IPage<CoreCustomForm>> appFindAdminFormList(@ApiParam("用户id") @RequestParam Long userId,
@ApiParam("学校id") @RequestParam Long schoolId,
@ApiParam("表单名称") @RequestParam(required = false) String tableName,
@ApiParam("表单状态,不传为全查") @RequestParam(required = false) Integer status,
@RequestParam(defaultValue = "10") Long pageSize,
@RequestParam(defaultValue = "1") Long pageNum){
return ResultBean.buildSuccess(formService.appFindAdminFormList(new Page<CoreCustomForm>(pageNum,pageSize),userId,tableName,status,schoolId));
}
@GetMapping("appHandOnCustomForm")
@ApiOperation("app用户查询用户是否是管理员")
public ResultBean appHandOnCustomForm(@ApiParam("用户id")@RequestParam Long userId,
@ApiParam("学校id")@RequestParam Long schoolId){
return ResultBean.buildSuccess(formService.appHandOnCustomForm(userId,schoolId));
}
/***
* @Author jianMingWang
* @Description 提交表单数据
* @Date 11:28 2021/8/11
* @Param [formDataInput]
* @return com.liuliu.data.custom.entity.ResultBean
**/
@ApiOperation("app提交保存表单数据")
@PostMapping("/saveFormData")
public ResultBean saveFormData(@RequestBody FormDataInput formDataInput) {
CoreCustomForm form = formService.getOne(Wrappers.lambdaQuery(new CoreCustomForm())
.eq(CoreCustomForm::getTableName, formDataInput.getTableName()));
//验证用否是否能填报
List<Long> userList = new ArrayList<>();
List<CoreCustomFormRelationUser> list = userService.list(Wrappers.lambdaQuery(new CoreCustomFormRelationUser())
.eq(CoreCustomFormRelationUser::getCustomFormId, form.getId()));
if (form.getRecever()==2){
List<Long> list1 = new ArrayList<>();
List<CoreCustomFormRelationUserParent> parentList = parentService.list(Wrappers.lambdaQuery(new CoreCustomFormRelationUserParent())
.eq(CoreCustomFormRelationUserParent::getCustomFormId, form.getId()));
for (CoreCustomFormRelationUserParent userParent : parentList) {
list1.add(userParent.getParentId());
}
if (!list1.contains(formDataInput.getUserId())){
return ResultBean.buildError("您不能填报该表");
}
}else {
for (CoreCustomFormRelationUser relationUser : list) {
userList.add(relationUser.getUserId());
}
if (!userList.contains(formDataInput.getUserId())) {
return ResultBean.buildError("您不能填报该表");
}
}
Map data = coreCustomFormDataService.findData(form.getId(), formDataInput.getUserId());
if (ObjectUtil.isNotEmpty(data)&&form.getUpdateType()==0){
return ResultBean.buildError("您已填报,请勿重复填写");
}
coreCustomFormDataService.saveFormData(formDataInput,data);
return ResultBean.buildSuccess();
}
@GetMapping("appFindFormAndData")
@ApiOperation("app查询表单填报详情")
public ResultBean appFindFormAndData(@ApiParam("用户id")@RequestParam Long userId,
@ApiParam("表单id")@RequestParam Long formId){
return ResultBean.buildSuccess(formService.appFindFormAndData(userId,formId));
}
@GetMapping("appFindStudentByForm")
@ApiOperation("app查询表单关联的学生列表")
public ResultBean<List<FormStudentVO>> appFindStudentByForm(@ApiParam("家长id")@RequestParam Long userId,
@ApiParam("表单id")@RequestParam Long formId){
return ResultBean.buildSuccess(formService.appFindStudentByForm(userId,formId));
}
}
@@ -0,0 +1,26 @@
package com.yida.data.form.customForm.entity;
import com.yida.data.common.core.entity.customform.CoreCustomFormItems;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* @ClassName FormDataReturn
* @Author jianMingWang
* @Date 2021/9/17 14:39
* @Version 1.0
**/
@Data
public class FormDataReturn {
private List<Map> list;
private Integer total;
private List<CoreCustomFormItems> filedList;
public FormDataReturn(List<Map> list, Integer total, List<CoreCustomFormItems> filedList) {
this.list = list;
this.total = total;
this.filedList = filedList;
}
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.entity;
/**
* @ClassName RedisKey
* @Author jianMingWang
* @Date 2021/9/17 13:47
* @Version 1.0
**/
public interface RedisKey {
/**
* 表单主体信息缓存key
*/
String FORM_LOCAL = "form.local.";
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuth;
/**
* 表单对应管理员权限表 Mapper
*
* @author ccl
* @date 2021-11-05 15:41:13
*/
public interface CoreCustomFormAuthMapper extends BaseMapper<CoreCustomFormAuth> {
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuthRelationForm;
/**
* 权限对应管理员表 Mapper
*
* @author ccl
* @date 2021-11-05 15:41:15
*/
public interface CoreCustomFormAuthRelationFormMapper extends BaseMapper<CoreCustomFormAuthRelationForm> {
}
@@ -0,0 +1,42 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 自定义表单 Mapper
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
public interface CoreCustomFormDataMapper{
List<String> findFormFiled(@Param("dbName") String dbName, @Param("tableName") String tableName);
void initSqlWithParameterReturnVoid(@Param("sql") String sql, @Param("parameterMap") Map parameterMap);
List<Map> initSqlWithNUllReturnListMap(@Param("sql") String sql);
Integer initSqlWithNUllReturnInteger(@Param("sql") String sql);
/**
* 查询对应表的数据
* @param sql
* @return
*/
Map findData(@Param("sql") String sql);
/**
* 清空数据表
* @param sql
*/
void truncateTable(@Param("sql") String sql);
void removeBySql(@Param("sql") String sql);
}
@@ -0,0 +1,23 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.customform.CoreCustomFormGroup;
import org.apache.ibatis.annotations.Param;
/**
* 表单组 Mapper
*
* @author ccl
* @date 2021-11-05 15:41:03
*/
public interface CoreCustomFormGroupMapper extends BaseMapper<CoreCustomFormGroup> {
/**
* 分页查询组列表并返回组内表name;
* @param objectPage
* @param groupName
* @return
*/
Page<CoreCustomFormGroup> findGroupPageList(@Param("objectPage") Page objectPage, @Param("groupName") String groupName);
}
@@ -0,0 +1,17 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormItemChildren;
import java.util.List;
/**
* 自定义表单组件 Mapper
*
* @author wjm
* @date 2021-08-12 10:45:22
*/
public interface CoreCustomFormItemChildrenMapper extends BaseMapper<CoreCustomFormItemChildren> {
}
@@ -0,0 +1,16 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormItemChildren;
import com.yida.data.common.core.entity.customform.CoreCustomFormItems;
import java.util.List;
/**
* 自定义表单组件 Mapper
*
* @author wjm
* @date 2021-08-12 10:44:45
*/
public interface CoreCustomFormItemsMapper extends BaseMapper<CoreCustomFormItems> {
}
@@ -0,0 +1,57 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 自定义表单 Mapper
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
public interface CoreCustomFormMapper extends BaseMapper<CoreCustomForm> {
IPage<CoreCustomForm> findPageList(@Param("page") Page page, @Param("coreCustomForm") CoreCustomForm coreCustomForm);
Integer initSqlReturnInt(@Param("sql") String sql);
void initSqlReturnVoid(@Param("sql") String sql);
/**
* 查询用户对应填写表单
* @param page
* @param userId
* @param tableName
* @param status
* @param schoolId
* @return
*/
IPage<CoreCustomForm> appFindFormList(@Param("page") Page<CoreCustomForm> page,
@Param("userIdList") List<Long> userIdList,
@Param("tableName") String tableName,
@Param("status") Integer status,
@Param("schoolId") Long schoolId,
@Param("type") Integer type);
/**
* 查询用户对应管理表单
* @param page
* @param userId
* @param tableName
* @param status
* @param schoolId
* @return
*/
IPage<CoreCustomForm> appFindAdminFormList(@Param("page") Page<CoreCustomForm> page,
@Param("userId") Long userId,
@Param("tableName") String tableName,
@Param("status") Integer status,
@Param("schoolId") Long schoolId);
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItemChildren;
/**
* 自定义表单模板组件 Mapper
*
* @author wjm
* @date 2021-08-30 15:22:32
*/
public interface CoreCustomFormModelItemChildrenMapper extends BaseMapper<CoreCustomFormModelItemChildren> {
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItems;
/**
* 自定义表单模板组件 Mapper
*
* @author wjm
* @date 2021-08-30 15:22:49
*/
public interface CoreCustomFormModelItemsMapper extends BaseMapper<CoreCustomFormModelItems> {
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormModel;
/**
* 自定义表单模板 Mapper
*
* @author wjm
* @date 2021-08-30 15:22:15
*/
public interface CoreCustomFormModelMapper extends BaseMapper<CoreCustomFormModel> {
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationAdmin;
/**
* 表单对应管理员 Mapper
*
* @author ccl
* @date 2021-11-05 15:41:08
*/
public interface CoreCustomFormRelationAdminMapper extends BaseMapper<CoreCustomFormRelationAdmin> {
}
@@ -0,0 +1,31 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUser;
import org.apache.ibatis.annotations.Param;
/**
* 表单对应可见人员表 Mapper
*
* @author ccl
* @date 2021-11-05 15:41:11
*/
public interface CoreCustomFormRelationUserMapper extends BaseMapper<CoreCustomFormRelationUser> {
/**
* 查询所有的人数和所有已填的人
* @param id
*/
Integer findUserNum(@Param("id") Long id);
/**
* 为填报得人员
* @param formId
* @return
*/
Integer findNotCommit(Long formId);
Page<CoreCustomFormRelationUser> findUserList(@Param("page") Page<CoreCustomFormRelationUser> page, @Param("type") Integer type,
@Param("name") String name, @Param("formId") Long formId);
}
@@ -0,0 +1,25 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUserParent;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import org.apache.ibatis.annotations.Param;
/**
* @author ccl
*/
public interface CoreCustomFormRelationUserParentMapper extends BaseMapper<CoreCustomFormRelationUserParent> {
/**
* 查询总数
* @param formId
* @return
*/
Integer findTotal(@Param("formId") Long formId);
/**
* 查询未提交数据
* @param formId
* @return
*/
Integer findParentStatistic(Long formId);
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
/**
* 表单对应统计数据表 Mapper
*
* @author ccl
* @date 2021-11-05 15:58:43
*/
public interface CoreCustomFormStatisticMapper extends BaseMapper<CoreCustomFormStatistic> {
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormTopical;
/**
* 表单对应主题表 Mapper
*
* @author ccl
* @date 2021-11-05 15:41:09
*/
public interface CoreCustomFormTopicalMapper extends BaseMapper<CoreCustomFormTopical> {
}
@@ -0,0 +1,14 @@
package com.yida.data.form.customForm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.customform.CoreCustomFormType;
/**
* 自定义表单类型表 Mapper
*
* @author wjm
* @date 2021-08-12 10:56:57
*/
public interface CoreCustomFormTypeMapper extends BaseMapper<CoreCustomFormType> {
}
@@ -0,0 +1,15 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuthRelationForm;
import java.util.List;
/**
* 权限对应管理员表 Service接口
*
* @author ccl
* @date 2021-11-05 15:41:15
*/
public interface CoreCustomFormAuthRelationFormService extends IService<CoreCustomFormAuthRelationForm> {
}
@@ -0,0 +1,16 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuth;
import java.util.List;
/**
* 表单对应管理员权限表 Service接口
*
* @author ccl
* @date 2021-11-05 15:41:13
*/
public interface CoreCustomFormAuthService extends IService<CoreCustomFormAuth> {
}
@@ -0,0 +1,74 @@
package com.yida.data.form.customForm.service;
import com.yida.data.customForm.dto.FormDataInput;
import com.yida.data.form.customForm.entity.FormDataReturn;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
/**
* 自定义表单 Service接口
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
public interface CoreCustomFormDataService {
/***
* @Author jianMingWang
* @Description 保存表单数据
* @Date 9:39 2021/9/17
* @Param formDataInput
* @return void
**/
void saveFormData(FormDataInput formDataInput,Map data);
/***
* @Author jianMingWang
* @Description //分页列表查询表单数据
* @Date 9:40 2021/9/17
* @Param [formId, pageSize, pageNo]
* @return java.util.List<java.util.Map>
**/
List<Map> findSubmitFormDataListByFormId(Integer formId, Integer pageSize, Integer pageNo);
/***
* @Author jianMingWang
* @Description //查询提交总数
* @Date 14:12 2021/9/17
* @Param [formId]
* @return java.lang.Integer
**/
Integer findSubmitFormDataTotalNumByFormId(Integer formId);
/***
* @Author jianMingWang
* @Description //分页查询表单数据
* @Date 14:34 2021/9/23
* @Param [formId, pageSize, pageNo]
* @return com.yida.data.customForm.entity.FormDataReturn
**/
FormDataReturn findList(Integer formId, Integer pageSize, Integer pageNo);
/***
* @Author jianMingWang
* @Description //导出表单数据
* @Date 14:34 2021/9/23
* @Param [formId, response]
* @return void
**/
void exportData(Integer formId, HttpServletResponse response) throws ParseException;
Map findData(Long formId, Long userId);
/**
* 清空
* @param sql
*/
void truncateTable(String sql);
}
@@ -0,0 +1,21 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormGroup;
/**
* 表单组 Service接口
*
* @author ccl
* @date 2021-11-05 15:41:03
*/
public interface CoreCustomFormGroupService extends IService<CoreCustomFormGroup> {
/**
* 查询分组列表,同时返回组内表名和id
* @return
*/
Page<CoreCustomFormGroup> findGroupPageList(Integer pageNum, Integer pageSize, String groupName);
}
@@ -0,0 +1,16 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormItemChildren;
/**
* 自定义表单组件选项 Service接口
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
public interface CoreCustomFormItemChildrenService extends IService<CoreCustomFormItemChildren> {
}
@@ -0,0 +1,20 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import com.yida.data.common.core.entity.customform.CoreCustomFormItems;
/**
* 自定义表单组件 Service接口
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
public interface CoreCustomFormItemsService extends IService<CoreCustomFormItems> {
}
@@ -0,0 +1,13 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItemChildren;
/**
* 自定义表单模板组件 Service接口
*
* @author wjm
* @date 2021-08-30 15:22:32
*/
public interface CoreCustomFormModelItemChildrenService extends IService<CoreCustomFormModelItemChildren> {
}
@@ -0,0 +1,13 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItems;
/**
* 自定义表单模板组件 Service接口
*
* @author wjm
* @date 2021-08-30 15:22:49
*/
public interface CoreCustomFormModelItemsService extends IService<CoreCustomFormModelItems> {
}
@@ -0,0 +1,13 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormModel;
/**
* 自定义表单模板 Service接口
*
* @author wjm
* @date 2021-08-30 15:22:15
*/
public interface CoreCustomFormModelService extends IService<CoreCustomFormModel> {
}
@@ -0,0 +1,17 @@
package com.yida.data.form.customForm.service;
import com.yida.data.common.core.entity.QueryRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationAdmin;
import java.util.List;
/**
* 表单对应管理员 Service接口
*
* @author ccl
* @date 2021-11-05 15:41:08
*/
public interface CoreCustomFormRelationAdminService extends IService<CoreCustomFormRelationAdmin> {
}
@@ -0,0 +1,18 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUserParent;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
/**
* @author ccl
*/
public interface CoreCustomFormRelationUserParentService extends IService<CoreCustomFormRelationUserParent> {
/**
* 查询家长统计数据
*
* @param formId
* @return
*/
CoreCustomFormStatistic findParentStatistic(Long formId);
}
@@ -0,0 +1,41 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.QueryRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUser;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import java.util.List;
/**
* 表单对应可见人员表 Service接口
*
* @author ccl
* @date 2021-11-05 15:41:11
*/
public interface CoreCustomFormRelationUserService extends IService<CoreCustomFormRelationUser> {
/**
* 查询对应表中所有应填人员,和已填人员
* @param id
*/
Integer findUserNum(Long id);
/**
* 查询统计数据
* @param formId
* @return
*/
CoreCustomFormStatistic findStatistic(Long formId);
/**
* 条件查询用户
* @param page
* @param type
* @param name
* @param formId
* @return
*/
Page<CoreCustomFormRelationUser> findUserList(Page<CoreCustomFormRelationUser> page, Integer type, String name, Long formId);
}
@@ -0,0 +1,144 @@
package com.yida.data.form.customForm.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.QueryRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUser;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import com.yida.data.customForm.dto.RemindAgainDTO;
import com.yida.data.customForm.dto.SaveCustomFormDTO;
import com.yida.data.customForm.vo.CommitUserVO;
import com.yida.data.customForm.vo.FormStudentVO;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 自定义表单 Service接口
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
public interface CoreCustomFormService extends IService<CoreCustomForm> {
IPage<CoreCustomForm> findCustomFormPageList(Page page, Long schoolId, Long formTypeId, String model, CurrentUser currentUser);
Integer saveForm(CoreCustomForm dto) throws Exception;
/**
* app查询用户对应填写表单
* @param objectPage
* @param userId
* @param formName
* @param status
* @param schoolId
* @return
*/
IPage<CoreCustomForm> appFindFormList(Page<CoreCustomForm> objectPage, Long userId,String tableName,Integer status,Long schoolId,Integer type);
/**
* app查询用户管理对应表单
* @param objectPage
* @param userId
* @param tableName
* @param status
* @param schoolId
* @return
*/
IPage<CoreCustomForm> appFindAdminFormList(Page<CoreCustomForm> objectPage, Long userId,String tableName,Integer status,Long schoolId);
/**
* 查询用户对应是否是管理员
* @param userId
* @param schoolId
* @return
*/
Boolean appHandOnCustomForm(Long userId,Long schoolId);
/**
* 查询表单详情
* @param id
* @return
*/
CoreCustomForm findById(Long id);
/**
* 删除表单,及对应附表
* @param id
*/
void delForm(Long id);
void updateAndSendNotice(Long formId);
/**
* 条件查询表单对应填报情况
* @param formId
* @param fillType
* @param page
* @return
*/
Page findCommitUser(Long formId, Integer fillType, Page page);
/**
* 查询表单对应统计数据
* @param formId
* @return
*/
CoreCustomFormStatistic findStatistic(Long formId);
/**
* 再次提醒
* @param dto
*/
void remindAgain(RemindAgainDTO dto);
/**
* 导出表单未提交和已提交的人员信息
* @param formId
* @param status
* @param response
*/
void exportUserListInOut(Long formId, Integer status, HttpServletResponse response);
/**
* 发布接口
* @param byId
*/
void publishForm(CoreCustomForm byId);
/**
* 查询表单和填报数据
* @param userId
* @param formId
* @return
*/
Object appFindFormAndData(Long userId, Long formId);
/**
* 条件查询
* @param formId
* @param type
* @param page
* @return
*/
CommitUserVO commitUser(Long formId, Integer type, String name, Page<CoreCustomFormRelationUser> page);
/**
* 通过表单查询对应需要填报的学生
* @param userId
* @param formId
* @return
*/
List<FormStudentVO> appFindStudentByForm(Long userId, Long formId);
}
@@ -0,0 +1,18 @@
package com.yida.data.form.customForm.service;
import com.yida.data.common.core.entity.QueryRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import java.util.List;
/**
* 表单对应统计数据表 Service接口
*
* @author ccl
* @date 2021-11-05 15:58:43
*/
public interface CoreCustomFormStatisticService extends IService<CoreCustomFormStatistic> {
}
@@ -0,0 +1,17 @@
package com.yida.data.form.customForm.service;
import com.yida.data.common.core.entity.QueryRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormTopical;
import java.util.List;
/**
* 表单对应主题表 Service接口
*
* @author ccl
* @date 2021-11-05 15:41:09
*/
public interface CoreCustomFormTopicalService extends IService<CoreCustomFormTopical> {
}
@@ -0,0 +1,18 @@
package com.yida.data.form.customForm.service;
import com.yida.data.common.core.entity.QueryRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomFormType;
import java.util.List;
/**
* 自定义表单类型表 Service接口
*
* @author wjm
* @date 2021-08-12 10:56:57
*/
public interface CoreCustomFormTypeService extends IService<CoreCustomFormType> {
}
@@ -0,0 +1,27 @@
package com.yida.data.form.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuthRelationForm;
import com.yida.data.form.customForm.mapper.CoreCustomFormAuthRelationFormMapper;
import com.yida.data.form.customForm.service.CoreCustomFormAuthRelationFormService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
/**
* 权限对应管理员表 Service实现
*
* @author ccl
* @date 2021-11-05 15:41:15
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormAuthRelationFormServiceImpl extends ServiceImpl
<CoreCustomFormAuthRelationFormMapper, CoreCustomFormAuthRelationForm> implements CoreCustomFormAuthRelationFormService {
private final CoreCustomFormAuthRelationFormMapper coreCustomFormAuthAdminMapper;
}
@@ -0,0 +1,26 @@
package com.yida.data.form.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuth;
import com.yida.data.form.customForm.mapper.CoreCustomFormAuthMapper;
import com.yida.data.form.customForm.service.CoreCustomFormAuthService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 表单对应管理员权限表 Service实现
*
* @author ccl
* @date 2021-11-05 15:41:13
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormAuthServiceImpl extends ServiceImpl
<CoreCustomFormAuthMapper, CoreCustomFormAuth> implements CoreCustomFormAuthService {
private final CoreCustomFormAuthMapper coreCustomFormAuthMapper;
}
@@ -0,0 +1,433 @@
package com.yida.data.form.customForm.service.impl;
import cc.mrbird.febs.common.redis.service.RedisService;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.entity.constant.AppConstant;
import com.yida.data.common.core.entity.customform.*;
import com.yida.data.common.core.entity.notice.qywx.BaseStaffNotice;
import com.yida.data.common.core.entity.notice.qywx.inside.Text;
import com.yida.data.common.core.entity.system.EduApp;
import com.yida.data.common.core.entity.user.EduParent;
import com.yida.data.common.core.entity.user.EduStaff;
import com.yida.data.common.core.entity.user.EduStudent;
import com.yida.data.common.core.utils.ExcelUtil;
import com.yida.data.common.core.utils.WxUtil;
import com.yida.data.common.service.CommonService;
import com.yida.data.customForm.dto.FormDataInput;
import com.yida.data.customForm.vo.ParentCommit;
import com.yida.data.form.customForm.entity.FormDataReturn;
import com.yida.data.form.customForm.entity.RedisKey;
import com.yida.data.form.customForm.mapper.CoreCustomFormDataMapper;
import com.yida.data.form.customForm.service.*;
import com.yida.data.user.feign.RemoteStaffService;
import com.yida.data.user.feign.RemoteStudentService;
import lombok.RequiredArgsConstructor;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static com.yida.data.common.core.entity.constant.CachePrefixConstant.STAFF_DATA;
import static com.yida.data.common.core.entity.constant.CachePrefixConstant.STUDENT_DATA;
/**
* 自定义表单 Service实现
*
* @author wjm
* @date 2021-08-11 20:55:19
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormDataServiceImpl implements CoreCustomFormDataService {
@Value("${edu.customform.dbname}")
private String dbName;
@Value("${febs.teacherFormUrl}")
private String teacherFormUrl;
@Resource
private CoreCustomFormDataMapper coreCustomFormDataMapper;
@Resource
private CoreCustomFormService coreCustomFormService;
@Resource
private CoreCustomFormItemsService coreCustomFormItemsService;
@Resource
private CoreCustomFormRelationUserService userService;
@Resource
private RedisService redisService;
@Resource
private RemoteStaffService remoteStaffService;
@Resource
private RemoteStudentService remoteStudentService;
@Resource
private CoreCustomFormRelationUserParentService parentService;
@Resource
private CoreCustomFormRelationAdminService adminService;
@Resource
private WxUtil wxUtil;
@Resource
private CommonService commonService;
@Override
public void saveFormData(FormDataInput formDataInput, Map data) {
CoreCustomForm form = coreCustomFormService.getOne(Wrappers.lambdaQuery(new CoreCustomForm())
.eq(CoreCustomForm::getTableName, formDataInput.getTableName()));
if (ObjectUtil.isNotEmpty(data)) {
String sql = "DELETE FROM " + formDataInput.getTableName() + " WHERE user_id = " + formDataInput.getUserId();
coreCustomFormDataMapper.removeBySql(sql);
}
List<String> filedList = coreCustomFormDataMapper.findFormFiled(dbName, formDataInput.getTableName());
JSONObject jsonObject = JSONUtil.parseObj(formDataInput.getJsonDataString());
List<String> parameterList = new ArrayList<>();
Map parameterMap = new HashMap();
String baseSql = "insert into " + formDataInput.getTableName() + "(";
filedList.forEach(filed -> {
parameterList.add("#{parameterMap." + filed + "}");
parameterMap.put(filed, jsonObject.get(filed));
});
parameterMap.put("create_date", new Date());
parameterMap.put("user_id", formDataInput.getUserId());
String finalSql = baseSql + String.join(",", filedList) + ")values(" + String.join(",", parameterList) + ")";
coreCustomFormDataMapper.initSqlWithParameterReturnVoid(finalSql, parameterMap);
//修改填报人填报状态
CoreCustomForm one = coreCustomFormService.getOne(Wrappers.lambdaQuery(new CoreCustomForm())
.eq(CoreCustomForm::getTableName, formDataInput.getTableName()));
if (one.getRecever() != 2) {
userService.update(Wrappers.lambdaUpdate(new CoreCustomFormRelationUser())
.eq(CoreCustomFormRelationUser::getCustomFormId, one.getId())
.eq(CoreCustomFormRelationUser::getUserId, formDataInput.getUserId())
.set(CoreCustomFormRelationUser::getFill, 1)
.set(CoreCustomFormRelationUser::getFillTime, LocalDateTime.now()));
} else if (one.getRecever() == 2) {
parentService.update(Wrappers.lambdaUpdate(new CoreCustomFormRelationUserParent())
.eq(CoreCustomFormRelationUserParent::getCustomFormId, one.getId())
.set(CoreCustomFormRelationUserParent::getFillType, 1)
.set(CoreCustomFormRelationUserParent::getFillTime, LocalDateTime.now()));
}
//新增数据发送通知
if (form.getRemindAdmin() == 1) {
//查询对应管理员
List<CoreCustomFormRelationAdmin> adminList = adminService.list(Wrappers.lambdaQuery(new CoreCustomFormRelationAdmin())
.eq(CoreCustomFormRelationAdmin::getCustomFormId, form.getId()));
for (CoreCustomFormRelationAdmin relationUser : adminList) {
EduStaff staff = remoteStaffService.getStaffNoPermission(relationUser.getAdminId()).getData();
BaseStaffNotice textSchoolNotice = new BaseStaffNotice();
EduApp appByCodeAndSchool = commonService.getAppByCodeAndSchool(AppConstant.INDEX_PARENT, null, form.getOrgId());
Text text = new Text();
textSchoolNotice.setText(text);
textSchoolNotice.setAgentid(appByCodeAndSchool.getWxAgentId());
String url = teacherFormUrl + appByCodeAndSchool.getWxCorpId() + "&loginType=0&userType=0&state=" + AppConstant.INDEX_PARENT + "&id=" + form.getId();
;
text.setContent("<a href='" + url + "'>" + form.getRemindAdminModel() + " " + staff.getName() + "已填报《" + form.getFormTitle() + "" + "</a>");
textSchoolNotice.setTouser(staff.getWxId());
String accessToken = wxUtil.getAccessToken(appByCodeAndSchool.getWxCorpId(), appByCodeAndSchool.getWxSecret());
wxUtil.pushStaffNotice(accessToken, textSchoolNotice);
}
}
}
@Override
public List<Map> findSubmitFormDataListByFormId(Integer formId, Integer pageSize, Integer pageNo) {
//查询formID对应的数据表
CoreCustomForm coreCustomForm = null;
if (redisService.hasKey(RedisKey.FORM_LOCAL + formId)) {
coreCustomForm = (CoreCustomForm) redisService.get(RedisKey.FORM_LOCAL + formId);
} else {
coreCustomForm = coreCustomFormService.getById(formId);
}
if (ObjectUtil.isEmpty(pageNo) && ObjectUtil.isEmpty(pageSize)) {
String initSql = "select * from " + coreCustomForm.getTableName();
return coreCustomFormDataMapper.initSqlWithNUllReturnListMap(initSql);
}
Integer limitBeginNum = pageNo == 1 ? 0 : (pageSize * (pageNo - 1));
Integer limitEndNum = pageNo * pageSize;
String initSql = "select * from " + coreCustomForm.getTableName() +
" limit " + limitBeginNum + "," + limitEndNum;
//查询出表单数据ListMap
//查询出表单数据
List<Map> maps = coreCustomFormDataMapper.initSqlWithNUllReturnListMap(initSql);
for (Map map : maps) {
Long userId = (Long) map.get("user_id");
//教职工
if (coreCustomForm.getRecever() == 0) {
EduStaff staff = (EduStaff) redisService.hget(STAFF_DATA, userId.toString());
if (ObjectUtil.isEmpty(staff)) {
staff = remoteStaffService.getStaff(userId).getData();
redisService.hset(STAFF_DATA, userId.toString(), staff);
}
map.put("staff", staff);
}
//学生
else if (coreCustomForm.getRecever() == 1) {
EduStudent student = (EduStudent) redisService.hget(STUDENT_DATA, userId.toString());
if (ObjectUtil.isEmpty(student)) {
student = remoteStudentService.getStudentNoPermission(userId).getData();
redisService.hset(STUDENT_DATA, userId.toString(), student);
}
map.put("student", student);
}
//家长
else if (coreCustomForm.getRecever() == 2) {
Long customUserId = parentService.getOne(Wrappers.lambdaQuery(new CoreCustomFormRelationUserParent())
.eq(CoreCustomFormRelationUserParent::getCustomFormId, formId)
.eq(CoreCustomFormRelationUserParent::getParentId, userId)).getCustomUserId();
Long studentId = userService.getById(customUserId).getUserId();
EduStudent student = (EduStudent) redisService.hget(STUDENT_DATA, studentId.toString());
if (ObjectUtil.isEmpty(student)) {
student = remoteStudentService.getStudentNoPermission(studentId).getData();
redisService.hset(STUDENT_DATA, studentId.toString(), student);
}
EduParent parent = student.getParents().stream().filter(p -> p.getId().equals(userId)).collect(Collectors.toList()).get(0);
ParentCommit parentCommit = new ParentCommit();
parentCommit.setParentName(student.getStuName() + parent.getParentType());
parentCommit.setPhone(parent.getMobile());
parentCommit.setSchoolName(student.getSchoolName());
parentCommit.setCampusName(student.getCampusName());
parentCommit.setSectionName(student.getSectionName());
parentCommit.setGradeName(student.getGradeName());
parentCommit.setClassName(student.getClassName());
map.put("parent", parentCommit);
}
}
return coreCustomFormDataMapper.initSqlWithNUllReturnListMap(initSql);
}
@Override
public Integer findSubmitFormDataTotalNumByFormId(Integer formId) {
CoreCustomForm coreCustomForm = null;
if (redisService.hasKey(RedisKey.FORM_LOCAL + formId)) {
coreCustomForm = (CoreCustomForm) redisService.get(RedisKey.FORM_LOCAL + formId);
} else {
coreCustomForm = coreCustomFormService.getById(formId);
}
String initSql = "select count(id) from " + coreCustomForm.getTableName();
//查询出表单数据ListMap
//查询出表单数据
return coreCustomFormDataMapper.initSqlWithNUllReturnInteger(initSql);
}
@Override
public FormDataReturn findList(Integer formId, Integer pageSize, Integer pageNo) {
List<Map> submitFormDataListByFormId = this.findSubmitFormDataListByFormId(formId, pageSize, pageNo);
Integer submitFormDataTotalNumByFormId = this.findSubmitFormDataTotalNumByFormId(formId);
List<CoreCustomFormItems> coreCustomFormItemList = coreCustomFormItemsService.list(Wrappers.<CoreCustomFormItems>query().lambda().eq(CoreCustomFormItems::getFormId, formId));
return new FormDataReturn(submitFormDataListByFormId, submitFormDataTotalNumByFormId, coreCustomFormItemList);
}
@Override
public void exportData(Integer formId, HttpServletResponse response) throws ParseException {
CoreCustomForm byId = coreCustomFormService.getById(formId);
if (byId.getRecever() == 0) {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet();
XSSFRow row = sheet.createRow(0);
List<CoreCustomFormItems> coreCustomFormItemList = coreCustomFormItemsService.list(Wrappers.<CoreCustomFormItems>query().lambda().eq(CoreCustomFormItems::getFormId, formId));
row.createCell(0).setCellValue("序号");
row.createCell(1).setCellValue("姓名");
row.createCell(2).setCellValue("电话");
row.createCell(coreCustomFormItemList.size() + 3).setCellValue("时间");
for (int i = 0; i < coreCustomFormItemList.size(); i++) {
row.createCell(i + 4).setCellValue(coreCustomFormItemList.get(i).getItemTitle());
}
List<Map> submitFormDataListByFormId = this.findSubmitFormDataListByFormId(formId, null, null);
for (int j = 0; j < submitFormDataListByFormId.size(); j++) {
XSSFRow row1 = sheet.createRow(j + 1);
Map map = submitFormDataListByFormId.get(j);
Iterator<String> iter = map.keySet().iterator();
while (iter.hasNext()) {
//字段名称
String key = iter.next();
//填报值
Object value = map.get(key);
if ("id".equals(key)) {
row1.createCell(0).setCellValue(ObjectUtil.toString(value));
continue;
}
if ("user_id".equals(key)) {
EduStaff hget = (EduStaff) redisService.hget(STAFF_DATA, value.toString());
row1.createCell(1).setCellValue(ObjectUtil.toString(hget.getName()));
row1.createCell(2).setCellValue(ObjectUtil.toString(hget.getMobile()));
continue;
}
if ("create_date".equals(key)) {
SimpleDateFormat myFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
row1.createCell(coreCustomFormItemList.size() + 2).setCellValue(myFmt.format(myFmt.parse(ObjectUtil.toString(value))));
continue;
}
for (int i = 0; i < coreCustomFormItemList.size(); i++) {
String itemFiledName = coreCustomFormItemList.get(i).getItemFiledName();
if (key.equals(itemFiledName)) {
row1.createCell(i + 3).setCellValue(ObjectUtil.toString(value));
}
}
}
}
ExcelUtil.export("表单数据", "xlsx", workbook, response);
} else if (byId.getRecever() == 1) {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet();
XSSFRow row = sheet.createRow(0);
List<CoreCustomFormItems> coreCustomFormItemList = coreCustomFormItemsService.list(Wrappers.<CoreCustomFormItems>query().lambda().eq(CoreCustomFormItems::getFormId, formId));
row.createCell(0).setCellValue("序号");
row.createCell(1).setCellValue("班级");
row.createCell(2).setCellValue("姓名");
row.createCell(3).setCellValue("学号");
row.createCell(coreCustomFormItemList.size() + 3).setCellValue("填报时间");
for (int i = 0; i < coreCustomFormItemList.size(); i++) {
row.createCell(i + 5).setCellValue(coreCustomFormItemList.get(i).getItemTitle());
}
List<Map> submitFormDataListByFormId = this.findSubmitFormDataListByFormId(formId, null, null);
for (int j = 0; j < submitFormDataListByFormId.size(); j++) {
XSSFRow row1 = sheet.createRow(j + 1);
Map map = submitFormDataListByFormId.get(j);
Iterator<String> iter = map.keySet().iterator();
while (iter.hasNext()) {
//字段名称
String key = iter.next();
//填报值
Object value = map.get(key);
if ("id".equals(key)) {
row1.createCell(0).setCellValue(ObjectUtil.toString(value));
continue;
}
if ("user_id".equals(key)) {
EduStudent hget = (EduStudent) redisService.hget(STUDENT_DATA, value.toString());
String classAndGrade = hget.getGradeName() + hget.getClassName();
row1.createCell(1).setCellValue(ObjectUtil.toString(classAndGrade));
row1.createCell(2).setCellValue(ObjectUtil.toString(hget.getStuName()));
row1.createCell(3).setCellValue(ObjectUtil.toString(hget.getStuNumber()));
continue;
}
if ("create_date".equals(key)) {
SimpleDateFormat myFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
row1.createCell(coreCustomFormItemList.size() + 3).setCellValue(myFmt.format(myFmt.parse(ObjectUtil.toString(value))));
continue;
}
for (int i = 0; i < coreCustomFormItemList.size(); i++) {
String itemFiledName = coreCustomFormItemList.get(i).getItemFiledName();
if (key.equals(itemFiledName)) {
row1.createCell(i + 5).setCellValue(ObjectUtil.toString(value));
}
}
}
}
ExcelUtil.export("表单数据", "xlsx", workbook, response);
} else if (byId.getRecever() == 2) {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet();
XSSFRow row = sheet.createRow(0);
List<CoreCustomFormItems> coreCustomFormItemList = coreCustomFormItemsService.list(Wrappers.<CoreCustomFormItems>query().lambda().eq(CoreCustomFormItems::getFormId, formId));
row.createCell(0).setCellValue("序号");
row.createCell(1).setCellValue("班级");
row.createCell(2).setCellValue("家长");
row.createCell(3).setCellValue("电话");
row.createCell(coreCustomFormItemList.size() + 3).setCellValue("填报时间");
for (int i = 0; i < coreCustomFormItemList.size(); i++) {
row.createCell(i + 5).setCellValue(coreCustomFormItemList.get(i).getItemTitle());
}
List<Map> submitFormDataListByFormId = this.findSubmitFormDataListByFormId(formId, null, null);
for (int j = 0; j < submitFormDataListByFormId.size(); j++) {
XSSFRow row1 = sheet.createRow(j + 1);
Map map = submitFormDataListByFormId.get(j);
Iterator<String> iter = map.keySet().iterator();
while (iter.hasNext()) {
//字段名称
String key = iter.next();
//填报值
Object value = map.get(key);
if ("id".equals(key)) {
row1.createCell(0).setCellValue(ObjectUtil.toString(value));
continue;
}
if ("user_id".equals(key)) {
CoreCustomFormRelationUserParent one = parentService.getOne(Wrappers.lambdaQuery(new CoreCustomFormRelationUserParent())
.eq(CoreCustomFormRelationUserParent::getCustomFormId, formId)
.eq(CoreCustomFormRelationUserParent::getParentId, key));
CoreCustomFormRelationUser relationStudent = userService.getById(one.getCustomUserId());
EduStudent hget = (EduStudent) redisService.hget(STUDENT_DATA, relationStudent.getUserId().toString());
List<EduParent> parents = hget.getParents();
EduParent parent = parents.stream().filter(p -> p.getWxId().equals(key)).collect(Collectors.toList()).get(0);
String classAndGrade = hget.getGradeName() + hget.getClassName();
row1.createCell(1).setCellValue(ObjectUtil.toString(classAndGrade));
row1.createCell(2).setCellValue(ObjectUtil.toString(parent.getParentType()));
row1.createCell(3).setCellValue(ObjectUtil.toString(parent.getMobile()));
continue;
}
if ("create_date".equals(key)) {
SimpleDateFormat myFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
row1.createCell(coreCustomFormItemList.size() + 3).setCellValue(myFmt.format(myFmt.parse(ObjectUtil.toString(value))));
continue;
}
for (int i = 0; i < coreCustomFormItemList.size(); i++) {
String itemFiledName = coreCustomFormItemList.get(i).getItemFiledName();
if (key.equals(itemFiledName)) {
row1.createCell(i + 4).setCellValue(ObjectUtil.toString(value));
}
}
}
}
ExcelUtil.export("表单数据", "xlsx", workbook, response);
}
}
@Override
public Map findData(Long formId, Long userId) {
CoreCustomForm form = coreCustomFormService.getById(formId);
String sql = "select * from " + form.getTableName() + " where user_id = " + userId;
return coreCustomFormDataMapper.findData(sql);
}
@Override
public void truncateTable(String sql) {
coreCustomFormDataMapper.truncateTable(sql);
}
}
@@ -0,0 +1,40 @@
package com.yida.data.form.customForm.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.customform.CoreCustomFormGroup;
import com.yida.data.form.customForm.mapper.CoreCustomFormGroupMapper;
import com.yida.data.form.customForm.service.CoreCustomFormGroupService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 表单组 Service实现
*
* @author ccl
* @date 2021-11-05 15:41:03
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormGroupServiceImpl extends ServiceImpl
<CoreCustomFormGroupMapper, CoreCustomFormGroup> implements CoreCustomFormGroupService {
private final CoreCustomFormGroupMapper coreCustomFormGroupMapper;
@Override
public Page<CoreCustomFormGroup> findGroupPageList(Integer pageNum,Integer pageSize,String groupName) {
Page<CoreCustomFormGroup> groupPage = page(new Page<>(pageNum, pageSize), Wrappers.lambdaQuery(new CoreCustomFormGroup())
.like(CoreCustomFormGroup::getGroupName, groupName)
.orderByDesc(CoreCustomFormGroup::getCreateDate));
return groupPage;
}
}
@@ -0,0 +1,27 @@
package com.yida.data.form.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormItemChildren;
import com.yida.data.form.customForm.mapper.CoreCustomFormItemChildrenMapper;
import com.yida.data.form.customForm.service.CoreCustomFormItemChildrenService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* 自定义表单类型表 Service实现
*
* @author wjm
* @date 2021-08-12 10:56:57
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormItemChildrenServiceImpl extends ServiceImpl<CoreCustomFormItemChildrenMapper, CoreCustomFormItemChildren> implements CoreCustomFormItemChildrenService {
@Resource
private final CoreCustomFormItemChildrenMapper coreCustomFormItemChildrenMapper;
}
@@ -0,0 +1,28 @@
package com.yida.data.form.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormItems;
import com.yida.data.form.customForm.mapper.CoreCustomFormItemsMapper;
import com.yida.data.form.customForm.service.CoreCustomFormItemsService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* 自定义表单类型表 Service实现
*
* @author wjm
* @date 2021-08-12 10:56:57
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormItemsServiceImpl extends ServiceImpl<CoreCustomFormItemsMapper, CoreCustomFormItems> implements CoreCustomFormItemsService {
@Resource
private final CoreCustomFormItemsMapper coreCustomFormItemsMapper;
}
@@ -0,0 +1,26 @@
package com.yida.data.form.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItemChildren;
import com.yida.data.form.customForm.mapper.CoreCustomFormModelItemChildrenMapper;
import com.yida.data.form.customForm.service.CoreCustomFormModelItemChildrenService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 自定义表单模板组件 Service实现
*
* @author wjm
* @date 2021-08-30 15:22:32
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormModelItemChildrenServiceImpl extends ServiceImpl
<CoreCustomFormModelItemChildrenMapper, CoreCustomFormModelItemChildren> implements CoreCustomFormModelItemChildrenService {
private final CoreCustomFormModelItemChildrenMapper coreCustomFormModelItemChildrenMapper;
}
@@ -0,0 +1,26 @@
package com.yida.data.form.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItems;
import com.yida.data.form.customForm.mapper.CoreCustomFormModelItemsMapper;
import com.yida.data.form.customForm.service.CoreCustomFormModelItemsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
/**
* 自定义表单模板组件 Service实现
*
* @author wjm
* @date 2021-08-30 15:22:49
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormModelItemsServiceImpl extends ServiceImpl
<CoreCustomFormModelItemsMapper, CoreCustomFormModelItems> implements CoreCustomFormModelItemsService {
private final CoreCustomFormModelItemsMapper coreCustomFormModelItemsMapper;
}
@@ -0,0 +1,26 @@
package com.yida.data.form.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormModel;
import com.yida.data.form.customForm.mapper.CoreCustomFormModelMapper;
import com.yida.data.form.customForm.service.CoreCustomFormModelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 自定义表单模板 Service实现
*
* @author wjm
* @date 2021-08-30 15:22:15
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormModelServiceImpl extends ServiceImpl
<CoreCustomFormModelMapper, CoreCustomFormModel> implements CoreCustomFormModelService {
private final CoreCustomFormModelMapper coreCustomFormModelMapper;
}
@@ -0,0 +1,26 @@
package com.yida.data.form.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationAdmin;
import com.yida.data.form.customForm.mapper.CoreCustomFormRelationAdminMapper;
import com.yida.data.form.customForm.service.CoreCustomFormRelationAdminService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 表单对应管理员 Service实现
*
* @author ccl
* @date 2021-11-05 15:41:08
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormRelationAdminServiceImpl extends ServiceImpl
<CoreCustomFormRelationAdminMapper, CoreCustomFormRelationAdmin> implements CoreCustomFormRelationAdminService {
private final CoreCustomFormRelationAdminMapper coreCustomFormRelationAdminMapper;
}

Some files were not shown because too many files have changed in this diff Show More