feat: 还原

This commit is contained in:
张云杰 2025-05-15 18:17:57 +08:00
parent 39f3acc15f
commit 0a7b7c1771
91 changed files with 4719 additions and 0 deletions
febs-server
edu-custom-form/edu-custom-form-biz/src/main
java/com/yida/data/customForm
EduCustomFormApplication.java
controller
entity
mapper
service
resources/mapper
edu-school
edu-user/edu-user-biz/src/main/resources/template

@ -0,0 +1,33 @@
package com.yida.data.customForm;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import org.mybatis.spring.annotation.MapperScan;
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.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import cc.mrbird.febs.common.security.starter.annotation.EnableFebsCloudResourceServer;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author wjm
*/
@EnableAsync
@EnableScheduling
@EnableFebsCloudResourceServer
@EnableFeignClients(basePackages = "com.yida.data")
@MapperScan("com.yida.data.customForm.mapper")
@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
@EnableTransactionManagement
public class EduCustomFormApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(EduCustomFormApplication.class)
.web(WebApplicationType.SERVLET)
.run(args);
}
}

@ -0,0 +1,53 @@
package com.yida.data.customForm.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuth;
import com.yida.data.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.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.customForm.service.CoreCustomFormItemChildrenService;
import com.yida.data.customForm.service.CoreCustomFormItemsService;
import com.yida.data.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,155 @@
package com.yida.data.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.FormDataInput;
import com.yida.data.customForm.dto.RemindAgainDTO;
import com.yida.data.customForm.entity.FormDataReturn;
import com.yida.data.customForm.service.CoreCustomFormDataService;
import com.yida.data.customForm.service.CoreCustomFormItemChildrenService;
import com.yida.data.customForm.service.CoreCustomFormItemsService;
import com.yida.data.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,73 @@
package com.yida.data.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.CoreCustomForm;
import com.yida.data.common.core.entity.customform.CoreCustomFormGroup;
import com.yida.data.customForm.dto.SaveFormRelationGroupDTO;
import com.yida.data.customForm.service.CoreCustomFormGroupService;
import com.yida.data.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,43 @@
package com.yida.data.customForm.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.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.*;
import javax.xml.transform.Result;
/**
* 自定义表单模板 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,54 @@
package com.yida.data.customForm.controller;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.FebsResponse;
import com.yida.data.common.core.entity.QueryRequest;
import com.yida.data.common.core.entity.customform.CoreCustomFormType;
import com.yida.data.common.core.exception.FebsException;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.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.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 自定义表单类型表 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,47 @@
package com.yida.data.customForm.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import com.yida.data.customForm.dto.RemindAgainDTO;
import com.yida.data.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,150 @@
package com.yida.data.customForm.controller.app;
import cn.hutool.core.collection.CollectionUtil;
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.common.core.entity.customform.CoreCustomFormStatistic;
import com.yida.data.common.core.exception.FebsException;
import com.yida.data.customForm.dto.FormDataInput;
import com.yida.data.customForm.service.CoreCustomFormDataService;
import com.yida.data.customForm.service.CoreCustomFormRelationUserParentService;
import com.yida.data.customForm.service.CoreCustomFormRelationUserService;
import com.yida.data.customForm.service.CoreCustomFormService;
import com.yida.data.customForm.vo.FormStudentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
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 javax.servlet.http.HttpServletResponse;
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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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,81 @@
package com.yida.data.customForm.service;
import cn.hutool.http.HttpResponse;
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.customForm.dto.CoreCustomFormData;
import com.yida.data.customForm.dto.FormDataInput;
import com.yida.data.customForm.entity.FormDataReturn;
import org.apache.ibatis.annotations.Param;
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.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.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.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.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.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.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.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.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.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.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.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.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.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.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuthRelationForm;
import com.yida.data.customForm.mapper.CoreCustomFormAuthRelationFormMapper;
import com.yida.data.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,32 @@
package com.yida.data.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormAuth;
import com.yida.data.customForm.mapper.CoreCustomFormAuthMapper;
import com.yida.data.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.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.QueryRequest;
import java.util.List;
/**
* 表单对应管理员权限表 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,440 @@
package com.yida.data.customForm.service.impl;
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.exception.FebsException;
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.entity.FormDataReturn;
import com.yida.data.customForm.entity.RedisKey;
import com.yida.data.customForm.mapper.CoreCustomFormDataMapper;
import com.yida.data.customForm.service.*;
import com.yida.data.customForm.vo.ParentCommit;
import com.yida.data.user.feign.RemoteStaffService;
import com.yida.data.user.feign.RemoteStudentService;
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 java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
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 lombok.RequiredArgsConstructor;
import static com.yida.data.common.core.entity.constant.CachePrefixConstant.*;
/**
* 自定义表单 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.CUSTOM_FORM_TEACHER, 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.CUSTOM_FORM_TEACHER+"&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.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.customForm.mapper.CoreCustomFormGroupMapper;
import com.yida.data.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,30 @@
package com.yida.data.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormItemChildren;
import com.yida.data.common.core.entity.customform.CoreCustomFormItems;
import com.yida.data.customForm.mapper.CoreCustomFormItemChildrenMapper;
import com.yida.data.customForm.mapper.CoreCustomFormItemsMapper;
import com.yida.data.customForm.service.CoreCustomFormItemChildrenService;
import com.yida.data.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 CoreCustomFormItemChildrenServiceImpl extends ServiceImpl<CoreCustomFormItemChildrenMapper, CoreCustomFormItemChildren> implements CoreCustomFormItemChildrenService {
@Resource
private final CoreCustomFormItemChildrenMapper coreCustomFormItemChildrenMapper;
}

@ -0,0 +1,31 @@
package com.yida.data.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormItems;
import com.yida.data.common.core.entity.customform.CoreCustomFormType;
import com.yida.data.customForm.mapper.CoreCustomFormItemsMapper;
import com.yida.data.customForm.mapper.CoreCustomFormTypeMapper;
import com.yida.data.customForm.service.CoreCustomFormItemsService;
import com.yida.data.customForm.service.CoreCustomFormTypeService;
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.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItemChildren;
import com.yida.data.customForm.mapper.CoreCustomFormModelItemChildrenMapper;
import com.yida.data.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.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormModelItems;
import com.yida.data.customForm.mapper.CoreCustomFormModelItemsMapper;
import com.yida.data.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.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormModel;
import com.yida.data.customForm.mapper.CoreCustomFormModelMapper;
import com.yida.data.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,32 @@
package com.yida.data.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationAdmin;
import com.yida.data.customForm.mapper.CoreCustomFormRelationAdminMapper;
import com.yida.data.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.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.QueryRequest;
import java.util.List;
/**
* 表单对应管理员 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;
}

@ -0,0 +1,32 @@
package com.yida.data.customForm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUserParent;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import com.yida.data.customForm.mapper.CoreCustomFormRelationUserParentMapper;
import com.yida.data.customForm.service.CoreCustomFormRelationUserParentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* @author ccl
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormRelationUserParentServiceImpl extends ServiceImpl
<CoreCustomFormRelationUserParentMapper, CoreCustomFormRelationUserParent> implements CoreCustomFormRelationUserParentService {
@Override
public CoreCustomFormStatistic findParentStatistic(Long formId) {
Integer total = baseMapper.findTotal(formId);
Integer notCommit =baseMapper.findParentStatistic(formId);
CoreCustomFormStatistic formStatistic = new CoreCustomFormStatistic();
formStatistic.setCustomFormId(formId);
formStatistic.setNotSubmitNum(notCommit);
formStatistic.setTotalNum(total);
formStatistic.setSubmitNum(total-notCommit);
return formStatistic;
}
}

@ -0,0 +1,54 @@
package com.yida.data.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUser;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import com.yida.data.customForm.mapper.CoreCustomFormRelationUserMapper;
import com.yida.data.customForm.service.CoreCustomFormRelationUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.QueryRequest;
import java.util.List;
/**
* 表单对应可见人员表 Service实现
*
* @author ccl
* @date 2021-11-05 15:41:11
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormRelationUserServiceImpl extends ServiceImpl
<CoreCustomFormRelationUserMapper, CoreCustomFormRelationUser> implements CoreCustomFormRelationUserService {
private final CoreCustomFormRelationUserMapper coreCustomFormRelationUserMapper;
@Override
public Integer findUserNum(Long id) {
return baseMapper.findUserNum(id);
}
@Override
public CoreCustomFormStatistic findStatistic(Long formId) {
Integer num = baseMapper.findNotCommit(formId);
CoreCustomFormStatistic formStatistic = new CoreCustomFormStatistic();
formStatistic.setTotalNum(findUserNum(formId));
formStatistic.setNotSubmitNum(num);
formStatistic.setSubmitNum(findUserNum(formId)-num);
formStatistic.setCustomFormId(formId);
return formStatistic;
}
@Override
public Page<CoreCustomFormRelationUser> findUserList(Page<CoreCustomFormRelationUser> page, Integer type, String name, Long formId) {
return baseMapper.findUserList(page,type,name,formId);
}
}

@ -0,0 +1,32 @@
package com.yida.data.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import com.yida.data.customForm.mapper.CoreCustomFormStatisticMapper;
import com.yida.data.customForm.service.CoreCustomFormStatisticService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.QueryRequest;
import java.util.List;
/**
* 表单对应统计数据表 Service实现
*
* @author ccl
* @date 2021-11-05 15:58:43
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormStatisticServiceImpl extends ServiceImpl
<CoreCustomFormStatisticMapper, CoreCustomFormStatistic> implements CoreCustomFormStatisticService {
private final CoreCustomFormStatisticMapper coreCustomFormStatisticMapper;
}

@ -0,0 +1,32 @@
package com.yida.data.customForm.service.impl;
import com.yida.data.common.core.entity.customform.CoreCustomFormTopical;
import com.yida.data.customForm.mapper.CoreCustomFormTopicalMapper;
import com.yida.data.customForm.service.CoreCustomFormTopicalService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.QueryRequest;
import java.util.List;
/**
* 表单对应主题表 Service实现
*
* @author ccl
* @date 2021-11-05 15:41:09
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormTopicalServiceImpl extends ServiceImpl
<CoreCustomFormTopicalMapper, CoreCustomFormTopical> implements CoreCustomFormTopicalService {
private final CoreCustomFormTopicalMapper coreCustomFormTopicalMapper;
}

@ -0,0 +1,35 @@
package com.yida.data.customForm.service.impl;
import cn.hutool.core.util.ObjectUtil;
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.CoreCustomFormType;
import com.yida.data.customForm.mapper.CoreCustomFormTypeMapper;
import com.yida.data.customForm.service.CoreCustomFormTypeService;
import org.checkerframework.checker.units.qual.C;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import lombok.RequiredArgsConstructor;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.QueryRequest;
import java.util.List;
/**
* 自定义表单类型表 Service实现
*
* @author wjm
* @date 2021-08-12 10:56:57
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoreCustomFormTypeServiceImpl extends ServiceImpl<CoreCustomFormTypeMapper, CoreCustomFormType> implements CoreCustomFormTypeService {
private final CoreCustomFormTypeMapper coreCustomFormTypeMapper;
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.atlas.biz.mapper.CoreCustomFormAuthAdminMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormAuthMapper">
</mapper>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormDataMapper">
<update id="truncateTable">
${sql}
</update>
<delete id="removeBySql">
${sql}
</delete>
<select id="findFormFiled" resultType="java.lang.String">
SELECT
COLUMN_NAME
FROM
information_schema. COLUMNS
WHERE
TABLE_SCHEMA = #{dbName}
AND TABLE_NAME = #{tableName}
</select>
<select id="initSqlWithParameterReturnVoid">
${sql}
</select>
<select id="initSqlWithNUllReturnListMap" resultType="java.util.Map">
${sql}
</select>
<select id="initSqlWithNUllReturnInteger" resultType="java.lang.Integer">
${sql}
</select>
<select id="findData" resultType="java.util.Map">
${sql}
</select>
</mapper>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormGroupMapper">
<resultMap id="baseResultMap" type="com.yida.data.common.core.entity.customform.CoreCustomFormGroup">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="description" property="description"/>
<result column="groupName" property="description"/>
<result column="createDate" property="description"/>
<result column="createId" property="description"/>
</resultMap>
<select id="findGroupPageList"
resultMap="baseResultMap">
SELECT
*
FROM
core_custom_form_group
WHERE
<if test="groupName != null and groupName !=''">
group_name LIKE CONCAT('%',#{groupName},'%')
</if>
order by create_date desc
</select>
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.atlas.biz.mapper.CoreCustomFormGroupRelationFormMapper">
</mapper>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormItemChildrenMapper">
</mapper>

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormItemsMapper">
<resultMap id="BaseResultMap" type="com.yida.data.common.core.entity.customform.CoreCustomFormItems">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="form_id" jdbcType="BIGINT" property="formId"/>
<result column="item_type" jdbcType="VARCHAR" property="itemType"/>
<result column="item_title" jdbcType="VARCHAR" property="itemTitle"/>
<result column="item_sub_title" jdbcType="VARCHAR" property="itemSubTitle"/>
<result column="needed" jdbcType="VARCHAR" property="needed"/>
<result column="onlyed" jdbcType="VARCHAR" property="onlyed"/>
<result column="input_width" jdbcType="INTEGER" property="inputWidth"/>
<result column="input_height" jdbcType="INTEGER" property="inputHeight"/>
<result column="input_min" jdbcType="INTEGER" property="inputMin"/>
<result column="input_max" jdbcType="INTEGER" property="inputMax"/>
<result column="input_placeholder" jdbcType="VARCHAR" property="inputPlaceholder"/>
<result column="input_verify" jdbcType="INTEGER" property="inputVerify"/>
<result column="default_value" jdbcType="VARCHAR" property="defaultValue"/>
<result column="layout" jdbcType="INTEGER" property="layout"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="create_id" jdbcType="BIGINT" property="createId"/>
<result column="update_id" jdbcType="BIGINT" property="updateId"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
</resultMap>
</mapper>

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormMapper">
<resultMap id="BaseResultMap" type="com.yida.data.common.core.entity.customform.CoreCustomForm">
<id column="id" property="id" jdbcType="BIGINT"/>
<result property="delFlag" column="del_flag"/>
<result property="headerImgUrl" column="header_img_url"/>
<result property="backgroundImgUrl" column="background_img_url"/>
<result property="createId" column="create_id" />
<result property="createDate" column="create_date" />
<result property="draft" column="draft" />
<result property="endDate" column="end_date" />
<result property="formRemark" column="form_remark" />
<result property="formTitle" column="form_title" />
<result property="formTypeId" column="form_type_id" />
<result property="groupId" column="group_id" />
<result property="model" column="model" />
<result property="open" column="open" />
<result property="orgId" column="org_id" />
<result property="pageOneQuestion" column="page_one_question" />
<result property="progressBar" column="progress_bar" />
<result property="publishDate" column="publish_date" />
<result property="publishType" column="publish_type" />
<result property="receipt" column="receipt" />
<result property="recever" column="recever" />
<result property="remind" column="remind" />
<result property="remindAdmin" column="remind_admin" />
<result property="remindAdminModel" column="remind_admin_model" />
<result property="remindHour" column="remind_hour" />
<result property="remindUser" column="remind_user" />
<result property="remindUserModel" column="remind_user_model" />
<result property="saveFormType" column="save_form_type" />
<result property="sorted" column="sorted" />
<result property="startDate" column="start_date" />
<result property="status" column="status" />
<result property="stopMaxTime" column="stop_max_time" />
<result property="stopMinTime" column="stop_min_time" />
<result property="submitNum" column="submit_num" />
<result property="tableName" column="table_name" />
<result property="typeName" column="type_name" />
<result property="updateDate" column="update_date" />
<result property="updateId" column="update_id" />
<result property="updateType" column="update_type" />
<collection property="coreCustomFormItemsList" ofType="com.yida.data.common.core.entity.customform.CoreCustomFormItems">
<result column="id" property="id"/>
<result column="form_id" property="formId"/>
<result column="default_value" property="defaultValue"/>
<result column="input_height" property="inputHeight"/>
<result column="file_num" property="fileNum"/>
<result column="input_max" property="inputMax"/>
<result column="input_min" property="inputMin"/>
<result column="input_placeholder" property="inputPlaceholder"/>
<result column="input_width" property="inputWidth"/>
<result column="input_verify" property="inputVerify"/>
<result column="item_filed_name" property="itemFiledName"/>
<result column="item_sub_title" property="itemSubTitle"/>
<result column="item_title" property="itemTitle"/>
<result column="item_type" property="itemType"/>
<result column="layout" property="layout"/>
<result column="sort" property="sort"/>
<result column="needed" property="needed"/>
<result column="onlyed" property="onlyed"/>
<result column="del_flag" property="delFlag"/>
</collection>
<collection property="coreCustomFormTopical" ofType="com.yida.data.common.core.entity.customform.CoreCustomFormTopical">
<result property="id" column="id"/>
<result property="backgroundImgUrl" column="background_img_url"/>
<result property="logoType" column="logo_type"/>
<result property="surfacePlotUrl" column="surface_plot_url"/>
<result property="headerImgUrl" column="header_img_url"/>
<result property="logoUrl" column="logo_url"/>
</collection>
</resultMap>
<select id="findPageList" resultMap="BaseResultMap"
parameterType="com.yida.data.common.core.entity.customform.CoreCustomForm">
select
cf.*,
ct.type_name
from core_custom_form cf
left join core_custom_form_type ct on cf.form_type_id = ct.id
where cf.del_flag = 0
<if test="coreCustomForm.orgId != null">
and cf.org_id = #{coreCustomForm.orgId}
</if>
<if test="coreCustomForm.createId != null">
and cf.create_id = #{coreCustomForm.createId}
</if>
<if test="coreCustomForm.formTypeId != null">
and cf.form_type_id = #{coreCustomForm.formTypeId}
</if>
order by cf.create_date desc
</select>
<select id="initSqlReturnInt" resultType="java.lang.Integer">
${sql}
</select>
<select id="initSqlReturnVoid">
${sql}
</select>
<select id="appFindAdminFormList" resultType="com.yida.data.common.core.entity.customform.CoreCustomForm">
SELECT
a.*
FROM
`core_custom_form` a
LEFT JOIN core_custom_form_relation_admin b ON a.id = b.custom_form_id
WHERE
b.admin_id = #{userId}
<if test="tableName !=null and tableName != ''">
and a.table_name = #{tableName}
</if>
and a.status = 1
and org_id = #{schoolId}
ORDER BY a.`status` asc,a.create_date desc
</select>
<select id="appFindFormList" resultType="com.yida.data.common.core.entity.customform.CoreCustomForm">
SELECT distinct
a.*
<if test="type != 1 ">
,b.fill
</if>
FROM
`core_custom_form` a
LEFT JOIN core_custom_form_relation_user b ON a.id = b.custom_form_id
WHERE
a.status = 1
<if test="userIdList != null and userIdList.size >0">
and b.user_id in
<foreach collection="userIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
and b.type = #{type}
<if test="tableName !=null and tableName != ''">
and a.form_title like concat ('%',#{tableName},'%')
</if>
and org_id = #{schoolId}
and a.del_flag = 0
ORDER BY a.`status` asc,a.create_date desc
</select>
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.school.index.mapper.CoreCustomFormModelItemChildrenMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.school.index.mapper.CoreCustomFormModelItemsMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.school.index.mapper.CoreCustomFormModelMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.atlas.biz.mapper.CoreCustomFormRelationAdminMapper">
</mapper>

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormRelationUserMapper">
<select id="findUserNum" resultType="java.lang.Integer">
SELECT
COUNT(id)
FROM
`core_custom_form_relation_user`
WHERE
custom_form_id = #{id}
</select>
<select id="findNotCommit" resultType="java.lang.Integer">
SELECT
COUNT(id)
FROM
`core_custom_form_relation_user`
WHERE
custom_form_id = #{id}
and fill = 0
</select>
<select id="findUserList"
resultType="com.yida.data.common.core.entity.customform.CoreCustomFormRelationUser">
SELECT
*
FROM
`core_custom_form_relation_user`
WHERE
fill = #{type}
<if test="name != null and name !=''">
AND user_name LIKE CONCAT( '%', #{name}, '%' )
</if>
AND custom_form_id = #{formId}
</select>
</mapper>

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormRelationUserParentMapper">
<select id="findTotal" resultType="java.lang.Integer">
SELECT
COUNT(id)
FROM
`core_custom_form_relation_user_parent`
WHERE
custom_form_id = #{formId}
</select>
<select id="findParentStatistic" resultType="java.lang.Integer">
SELECT
COUNT(id)
FROM
`core_custom_form_relation_user_parent`
WHERE
custom_form_id = #{formId}
and fill_type = 0
</select>
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.atlas.biz.mapper.CoreCustomFormStatisticMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.atlas.biz.mapper.CoreCustomFormTopicalMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yida.data.customForm.mapper.CoreCustomFormTypeMapper">
</mapper>

@ -0,0 +1,38 @@
package com.yida.data.school.fallback.transaction;
import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.school.feign.transaction.RemoteStudentApplyService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Map;
/**
* RemoteStudentApplyService fallback处理类
*
* @author ZYJ
* @date 2022/8/26
*/
@Slf4j
@Fallback
public class RemoteStudentApplyServiceFallback implements FallbackFactory<RemoteStudentApplyService> {
@Override
public RemoteStudentApplyService create(Throwable throwable) {
log.error("RemoteStudentApplyService fallback reason:{}", throwable.getMessage());
return new RemoteStudentApplyService() {
@Override
public ResultBean<Map<Long, List<String>>> listApplyCode(Long[] studentIds) {
return null;
}
@Override
public ResultBean<Boolean> hasApply(Long studentId, String applyCode) {
return null;
}
};
}
}

@ -0,0 +1,24 @@
package com.yida.data.school.feign.transaction;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.constant.FebsServerConstant;
import com.yida.data.school.fallback.transaction.RemoteStudentApplyServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@FeignClient(value = FebsServerConstant.EDU_SCHOOL, contextId = "studentApplyServiceClient",
fallbackFactory = RemoteStudentApplyServiceFallback.class)
public interface RemoteStudentApplyService {
@GetMapping("/in/transaction/studentApply/listApply")
ResultBean<Map<Long, List<String>>> listApplyCode(@RequestParam("studentIds") Long[] studentIds);
@GetMapping("/transaction/studentApply/hasApply")
ResultBean<Boolean> hasApply(@RequestParam("studentId") Long studentId,
@RequestParam("applyCode") String applyCode);
}

@ -0,0 +1,25 @@
package com.yida.data.school.vo.news;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 发布稿件进度 - 实体
*/
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ManuscriptPublishPathVO {
@ApiModelProperty("名称")
private String label;
@ApiModelProperty("")
private Integer value;
private static Integer wxPath = 0;
}

@ -0,0 +1,14 @@
package com.yida.data.school.vo.transcation;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;
@Data
public class StudentApplyImportErrorVO {
@ExcelProperty(index = 1, value = "有效结束时间")
@ApiModelProperty("错误信息")
private String errorMsg;
}

@ -0,0 +1,13 @@
package com.yida.data.school.vo.transcation;
import lombok.Data;
@Data
public class StudentApplyImportProgressVO {
private Integer totalNum;
private Integer currentNum;
private String errorPageUrl;
private Integer finish;
private String redisKey;
}

@ -0,0 +1,57 @@
package com.yida.data.school.vo.transcation;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yida.data.common.core.converter.LocalDateTimeConverter;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
@Data
public class StudentApplyImportVO {
@ExcelProperty(index = 0, value = "序号")
@ApiModelProperty(value = "序号")
private Long indexNo;
@ExcelProperty(index = 1, value = "学校名称")
@ApiModelProperty("学校名称")
private String schoolName;
@ExcelProperty(index = 2, value = "校区名称")
@ApiModelProperty("校区名称")
private String campusName;
@ExcelProperty(index = 3, value = "学段名称")
@ApiModelProperty("学段名称")
private String sectionName;
@ExcelProperty(index = 4, value = "年级名称")
@ApiModelProperty("年级名称")
private String gradeName;
@ExcelProperty(index = 5, value = "班级名称")
@ApiModelProperty("班级名称")
private String className;
@ExcelProperty(index = 6, value = "学生姓名")
@ApiModelProperty("学生姓名")
private String studentName;
@ExcelProperty(index = 7, value = "学生学号")
@ApiModelProperty("学生学号")
private String studentNumber;
@ExcelProperty(index = 8, value = "开通应用")
@ApiModelProperty("开通应用")
private String applyCode;
@ExcelProperty(index = 9, value = "有效开始时间")
@ApiModelProperty("有效开始时间")
private String startTime;
@ExcelProperty(index = 10, value = "有效结束时间")
@ApiModelProperty("有效结束时间")
private String endTime;
}

@ -0,0 +1,16 @@
package com.yida.data.school.vo.transcation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
public class StudentApplyStatusVO {
@ApiModelProperty("应用状态0-未开通1-使用中2-已过期")
private Integer status;
@ApiModelProperty("过期时间")
private LocalDate deadLine;
}

@ -0,0 +1,147 @@
package com.yida.data.school.transaction.controller;
import cc.mrbird.febs.common.redis.service.RedisService;
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.annotation.ControllerLog;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.apply.EduApply;
import com.yida.data.common.core.entity.apply.EduStudentApply;
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
import com.yida.data.common.core.entity.constant.FebsConstant;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.school.transaction.service.EduStudentApplyService;
import com.yida.data.school.vo.transcation.EduApplyVO;
import com.yida.data.school.vo.transcation.StudentApplyImportProgressVO;
import com.yida.data.school.vo.transcation.StudentApplyStatusVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import org.springframework.web.multipart.MultipartFile;
@Api(tags = "交易-学生应用关系")
@RequiredArgsConstructor
@RequestMapping("/transaction/studentApply")
@RestController
public class EduStudentApplyController {
private final EduStudentApplyService eduStudentApplyService;
private final RedisService redisService;
@ApiOperation("分页查询学生开通应用")
@GetMapping("/listStudentApply")
@ControllerLog(operation = "分页查询学生开通应用")
public ResultBean<IPage<EduStudentApply>> listApply(
@ApiParam("学生名字") @RequestParam(required = false) String studentName,
@ApiParam("学号") @RequestParam(required = false) String studentNumber,
@ApiParam("学校ID") @RequestParam(required = false) Long schoolId,
@ApiParam("校区ID") @RequestParam(required = false) Long campusId,
@ApiParam("学段ID") @RequestParam(required = false) Long sectionId,
@ApiParam("年级ID") @RequestParam(required = false) Long gradeId,
@ApiParam("班级ID") @RequestParam(required = false) Long classId,
@ApiParam("当前页码") @RequestParam(defaultValue = "1") Integer pageNum,
@ApiParam("页面大小") @RequestParam(defaultValue = "10") Integer pageSize) {
Page<EduStudentApply> page = new Page<>();
page.setCurrent(pageNum);
page.setSize(pageSize);
return ResultBean.buildSuccess(
eduStudentApplyService
.listStudentApply(studentName, studentNumber, schoolId, sectionId, campusId, gradeId, classId, page));
}
@ApiOperation("获取开通应用详情")
@GetMapping("/getStudentApply")
@ControllerLog(operation = "获取开通应用详情")
public ResultBean<EduStudentApply> getStudentApply(@ApiParam("主键ID") Long id) {
return ResultBean.buildSuccess(eduStudentApplyService.getById(id));
}
@ApiOperation("删除开通应用")
@GetMapping("/deleteStudentApply")
@ControllerLog(operation = "删除学生开通应用")
public ResultBean deleteStudentApply(@ApiParam("主键ID") Long id) {
eduStudentApplyService.update(Wrappers.lambdaUpdate(new EduStudentApply())
.eq(EduStudentApply::getId, id)
.set(EduStudentApply::getDelFlag, 1));
return ResultBean.buildSuccess();
}
@ApiOperation("保存学生开通应用")
@PostMapping("/saveStudentApply")
@ControllerLog(operation = "保存学生开通应用")
public ResultBean insertApply(@ApiParam("开通应用") @RequestBody EduStudentApply eduStudentApply) {
eduStudentApplyService.save(eduStudentApply);
return ResultBean.buildSuccess();
}
@ApiOperation("查询学生是否拥有该应用权限")
@GetMapping("/hasApply")
public ResultBean<Boolean> listApplyCode(@ApiParam("学生id") Long studentId,
@ApiParam("应用编码") String applyCode) {
return ResultBean.buildSuccess(eduStudentApplyService.count(Wrappers.lambdaQuery(new EduStudentApply())
.eq(EduStudentApply::getStudentId, studentId)
.eq(EduStudentApply::getApplyCode, applyCode)
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
.le(EduStudentApply::getStartTime, LocalDateTime.now())) > 0);
}
@ApiOperation("查询学生的应用状态")
@GetMapping("/getApplyStatus")
public ResultBean<StudentApplyStatusVO> getApplyStatus(@ApiParam("学生id") Long studentId,
@ApiParam("应用编码") String applyCode) {
return ResultBean.buildSuccess(eduStudentApplyService.getStudentApplyStatus(studentId, applyCode));
}
@ApiOperation("下载学生开通应用导入模板")
@PostMapping("/downloadTemplate")
public void downloadTemplate(HttpServletResponse response) throws Exception {
eduStudentApplyService.downloadTemplate(response);
}
@ApiOperation("导入学生开通应用信息")
@PostMapping("/importStudentApplyInfo")
public ResultBean<StudentApplyImportProgressVO> importStudentApplyInfo(@RequestParam(value = "file") MultipartFile file)
throws Exception {
String redisKey = UUID.randomUUID().toString();
StudentApplyImportProgressVO progressVO = new StudentApplyImportProgressVO();
progressVO.setRedisKey(redisKey);
progressVO.setFinish(0);
progressVO.setTotalNum(0);
progressVO.setCurrentNum(0);
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
eduStudentApplyService.importStudentApplyInfo(file, redisKey);
return ResultBean.buildSuccess(progressVO);
}
@ApiOperation("获取导入学生开通应用信息进度")
@GetMapping("/getImportStudentApplyInfoProgress")
public ResultBean<StudentApplyImportProgressVO> getImportStudentApplyInfoProgress(@RequestParam("redisKey") String redisKey) {
return ResultBean.buildSuccess(eduStudentApplyService.getImportStudentApplyInfoProgress(redisKey));
}
@ApiOperation("删除缓存导入进度")
@GetMapping("/deleteRedisStudentApplyImportProgress")
public ResultBean deleteRedisStudentApplyImportProgress(@RequestParam("redisKey") String redisKey) {
redisService.hdel(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey);
return ResultBean.buildSuccess();
}
}

@ -0,0 +1,52 @@
package com.yida.data.school.transaction.controller;
import cc.mrbird.febs.common.redis.service.RedisService;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.apply.EduStudentApply;
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
import com.yida.data.school.transaction.service.EduStudentApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Api(tags = "交易-学生应用关系(不鉴权)")
@RequiredArgsConstructor
@RequestMapping("/in/transaction/studentApply")
@RestController
public class InEduStudentApplyController {
private final EduStudentApplyService eduStudentApplyService;
private final RedisService redisService;
@ApiOperation("查询学生的应用编码列表")
@GetMapping("/listApply")
public ResultBean<Map<Long, List<String>>> listApplyCode(@RequestParam("studentIds") Long[] studentIds) {
List<EduStudentApply> applyCodeList = eduStudentApplyService.list(Wrappers.lambdaQuery(new EduStudentApply())
.in(EduStudentApply::getStudentId, studentIds)
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
.le(EduStudentApply::getStartTime, LocalDateTime.now()));
Map<Long, List<String>> res = new HashMap<>();
if (CollUtil.isNotEmpty(applyCodeList)) {
Map<Long, List<EduStudentApply>> collect = applyCodeList.stream().collect(Collectors.groupingBy(EduStudentApply::getStudentId));
for (Map.Entry<Long, List<EduStudentApply>> entry : collect.entrySet()) {
List<String> applyCode = entry.getValue().stream().map(x -> x.getApplyCode()).distinct().collect(Collectors.toList());
res.put(entry.getKey(), applyCode);
redisService.hset(CachePrefixConstant.STUDENT_APPLY, entry.getKey().toString(), applyCode);
}
}
return ResultBean.buildSuccess(res);
}
}

@ -0,0 +1,53 @@
package com.yida.data.school.transaction.listener;
import cc.mrbird.febs.common.redis.service.RedisService;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yida.data.common.core.entity.apply.EduStudentApply;
import com.yida.data.common.service.CommonService;
import com.yida.data.school.transaction.service.EduStudentApplyService;
import com.yida.data.school.vo.transcation.StudentApplyImportVO;
import com.yida.data.user.dto.ImportStudentDormDTO;
import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RequiredArgsConstructor
public class importStudentApplyListener extends AnalysisEventListener<StudentApplyImportVO> {
private EduStudentApplyService eduStudentApplyService;
private List<StudentApplyImportVO> list = new ArrayList<>();
private String key;
public importStudentApplyListener(EduStudentApplyService eduStudentApplyService, String key) {
this.eduStudentApplyService = eduStudentApplyService;
this.key = key;
}
@Override
public void invoke(StudentApplyImportVO data, AnalysisContext context) {
if (null == data) {
log.info("excel导入失败:{}", data.toString());
}
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
public void saveData() {
eduStudentApplyService.insertStudentApplyData(list, key);
}
}

@ -0,0 +1,21 @@
package com.yida.data.school.transaction.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.apply.EduStudentApply;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface EduStudentApplyMapper extends BaseMapper<EduStudentApply> {
List<EduStudentApply> getStudentApplyStatus(@Param("studentId") Long studentId,
@Param("applyCode") String applyCode);
IPage<EduStudentApply> listStudentApply(@Param("studentName") String studentName,
@Param("studentNumber") String studentNumber,
@Param("schoolId") Long schoolId, @Param("sectionId") Long sectionId,@Param("campusId") Long campusId,
@Param("gradeId") Long gradeId, @Param("classId") Long classId, Page page);
}

@ -0,0 +1,48 @@
package com.yida.data.school.transaction.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.common.ResultBean;
import com.yida.data.common.core.entity.apply.EduStudentApply;
import com.yida.data.school.vo.transcation.StudentApplyImportErrorVO;
import com.yida.data.school.vo.transcation.StudentApplyImportProgressVO;
import com.yida.data.school.vo.transcation.StudentApplyImportVO;
import com.yida.data.school.vo.transcation.StudentApplyStatusVO;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
public interface EduStudentApplyService extends IService<EduStudentApply> {
StudentApplyStatusVO getStudentApplyStatus(Long studentId, String applyCode);
IPage<EduStudentApply> listStudentApply(String studentName,
String studentNumber,
Long schoolId,
Long sectionId,
Long campusId,
Long gradeId,
Long classId,
Page<EduStudentApply> page);
/**
* 下载学生开通应用模板
*
* @param response
* @throws Exception
*/
void downloadTemplate(HttpServletResponse response) throws Exception;
@Async
void importStudentApplyInfo(MultipartFile file, String redisKey) throws IOException;
void insertStudentApplyData(List<StudentApplyImportVO> studentApplyImportVOList, String redisKey);
StudentApplyImportProgressVO getImportStudentApplyInfoProgress( String redisKey);
}

@ -0,0 +1,245 @@
package com.yida.data.school.transaction.service.impl;
import cc.mrbird.febs.common.redis.service.RedisService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.common.ResultMsgType;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.apply.EduStudentApply;
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.EduStudent;
import com.yida.data.common.core.enums.ImportTemplateTypeEnum;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.common.core.utils.FileUtil;
import com.yida.data.common.service.CommonService;
import com.yida.data.school.transaction.listener.importStudentApplyListener;
import com.yida.data.school.transaction.mapper.EduStudentApplyMapper;
import com.yida.data.school.transaction.service.EduStudentApplyService;
import com.yida.data.school.vo.transcation.StudentApplyImportErrorVO;
import com.yida.data.school.vo.transcation.StudentApplyImportProgressVO;
import com.yida.data.school.vo.transcation.StudentApplyImportVO;
import com.yida.data.school.vo.transcation.StudentApplyStatusVO;
import com.yida.data.user.dto.ListStudentDTO;
import com.yida.data.user.dto.StudentErrorExportDTO;
import com.yida.data.user.dto.WelcomeInviteImportDTO;
import com.yida.data.user.feign.RemoteStudentService;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Objects;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.util.StopWatch;
import org.springframework.web.multipart.MultipartFile;
@Slf4j
@Service
@RequiredArgsConstructor
public class EduStudentApplyServiceImpl extends ServiceImpl<EduStudentApplyMapper, EduStudentApply> implements
EduStudentApplyService {
private final CommonService commonService;
private final RedisService redisService;
private final RemoteStudentService remoteStudentService;
@Value("${febs.uploadUrl}")
private String uploadUrl;
@Override
public StudentApplyStatusVO getStudentApplyStatus(Long studentId, String applyCode) {
StudentApplyStatusVO applyStatus = new StudentApplyStatusVO();
List<EduStudentApply> list = list(Wrappers.lambdaQuery(new EduStudentApply()).eq(EduStudentApply::getStudentId,
studentId)
.eq(EduStudentApply::getApplyCode, applyCode)
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
.le(EduStudentApply::getStartTime, LocalDateTime.now()));
if (CollUtil.isEmpty(list)) {
List<EduStudentApply> applyList = baseMapper.getStudentApplyStatus(studentId, applyCode);
if (CollUtil.isNotEmpty(applyList)) {
applyStatus.setStatus(2);
applyStatus.setDeadLine(applyList.get(0).getEndTime().toLocalDate().plusDays(1L));
} else {
applyStatus.setStatus(0);
}
} else {
applyStatus.setStatus(1);
}
return applyStatus;
}
@Override
public IPage<EduStudentApply> listStudentApply(String studentName, String studentNumber, Long schoolId, Long sectionId,
Long campusId,
Long gradeId, Long classId, Page<EduStudentApply> page) {
IPage<EduStudentApply> eduStudentApplyIPage = this.baseMapper
.listStudentApply(studentName, studentNumber, schoolId, sectionId, campusId, gradeId, classId, page);
return eduStudentApplyIPage;
}
@Override
public void downloadTemplate(HttpServletResponse response) throws Exception {
String fileName = "学生开通应用导入模板.xls";
// 获取导入文件模板
ClassPathResource classPathResource = new ClassPathResource("template/" + fileName);
InputStream inputStream = classPathResource.getInputStream();
FileUtil.download(FileUtil.inputStreamToFile(inputStream), fileName, false, response);
}
@Override
public void importStudentApplyInfo(MultipartFile file, String redisKey) throws IOException {
log.info("开始导入学生开通应用数据");
StopWatch stopWatch = new StopWatch();
stopWatch.start();
EasyExcel.read(file.getInputStream(), StudentApplyImportVO.class,
new importStudentApplyListener(this, redisKey))
.sheet(0).headRowNumber(1).doRead();
stopWatch.stop();
log.info("导入学生开通应用数据总共耗时: {}", stopWatch.getTotalTimeSeconds() + "");
}
@Override
public void insertStudentApplyData(List<StudentApplyImportVO> studentApplyImportVOList, String redisKey) {
StudentApplyImportProgressVO progressVO = new StudentApplyImportProgressVO();
progressVO.setFinish(0);
progressVO.setTotalNum(studentApplyImportVOList.size());
progressVO.setCurrentNum(0);
progressVO.setRedisKey(redisKey);
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
List<StudentApplyImportErrorVO> errorVOList = new ArrayList<>();
List<EduStudentApply> saveData = new ArrayList<>();
Integer index = 1;
for (StudentApplyImportVO studentApplyImportVO : studentApplyImportVOList) {
index++;
String baseMag = "" + index + "行,";
StudentApplyImportErrorVO studentApplyImportErrorVO = checkImportDataIsNull(index, studentApplyImportVO);
if (studentApplyImportErrorVO != null) {
errorVOList.add(studentApplyImportErrorVO);
continue;
}
Dept dept = commonService.getSchoolByName(studentApplyImportVO.getSchoolName());
if (ObjectUtil.isNull(dept)) {
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
errorVO.setErrorMsg(baseMag + "学校名称不匹配");
errorVOList.add(errorVO);
continue;
}
// 根据学校ID学号查询学生信息 检测学号与学生姓名是否匹配
EduStudent student = new EduStudent();
student.setSchoolId(dept.getDeptId());
student.setStuNumber(studentApplyImportVO.getStudentNumber());
List<EduStudent> currentStudentList = remoteStudentService.listBaseStudentNoJoin(student).getData();
if (CollUtil.isEmpty(currentStudentList)) {
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
errorVO.setErrorMsg(baseMag + "学生学号有误");
errorVOList.add(errorVO);
continue;
}
if (!ObjectUtil.equal(studentApplyImportVO.getStudentName(), currentStudentList.get(0).getStuName())) {
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
errorVO.setErrorMsg(baseMag + "学生姓名与学号不匹配");
errorVOList.add(errorVO);
continue;
}
EduStudentApply eduStudentApply = new EduStudentApply();
eduStudentApply.setStudentId(currentStudentList.get(0).getId());
eduStudentApply.setApplyCode(studentApplyImportVO.getApplyCode());
eduStudentApply
.setStartTime(LocalDateTimeUtil
.parse(studentApplyImportVO.getStartTime() + " 00:00:00", "yyyy-MM-dd HH:mm:ss"));
eduStudentApply
.setEndTime(LocalDateTimeUtil
.parse(studentApplyImportVO.getEndTime() + " 00:00:00", "yyyy-MM-dd HH:mm:ss"));
saveData.add(eduStudentApply);
progressVO.setCurrentNum(index - 1);
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
}
if (CollUtil.isNotEmpty(saveData)) {
super.saveBatch(saveData);
}
productErrorExcel(errorVOList, progressVO);
}
@Override
public StudentApplyImportProgressVO getImportStudentApplyInfoProgress(String redisKey) {
return (StudentApplyImportProgressVO) redisService
.hget(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey);
}
public void productErrorExcel(List<StudentApplyImportErrorVO> errorVOList, StudentApplyImportProgressVO progressVO) {
// 错误信息文件名称
if (CollUtil.isNotEmpty(errorVOList)) {
String fileName = FileUtil.getLocalUploadAddress() + UUID.randomUUID().toString() + ".xlsx";
EasyExcel.write(fileName, StudentApplyImportErrorVO.class)
.sheet("错误信息")
.doWrite(errorVOList);
// 上传到媒资
String url = FileUtil.uploadFileToMediaServer(uploadUrl, new File(fileName));
progressVO.setErrorPageUrl(url);
}
progressVO.setFinish(1);
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, progressVO.getRedisKey(), progressVO);
}
/**
* 检测插入数据是否为空
*
* @return
*/
public StudentApplyImportErrorVO checkImportDataIsNull(Integer index, StudentApplyImportVO studentApplyImportVO) {
StudentApplyImportErrorVO studentApplyImportErrorVO = null;
String baseMag = "" + index + "行,";
if (ObjectUtil.isNull(studentApplyImportVO.getSchoolName())) {
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
studentApplyImportErrorVO.setErrorMsg(baseMag + "学校名称为空");
}
if (ObjectUtil.isNull(studentApplyImportVO.getStudentName())) {
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
studentApplyImportErrorVO.setErrorMsg(baseMag + "学生姓名为空");
}
if (ObjectUtil.isNull(studentApplyImportVO.getStudentNumber())) {
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
studentApplyImportErrorVO.setErrorMsg(baseMag + "学生学号为空");
}
if (ObjectUtil.isNull(studentApplyImportVO.getApplyCode())) {
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
studentApplyImportErrorVO.setErrorMsg(baseMag + "开通应用为空");
}
if (ObjectUtil.isNull(studentApplyImportVO.getStartTime())) {
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
studentApplyImportErrorVO.setErrorMsg(baseMag + "有效开始时间为空");
}
if (ObjectUtil.isNull(studentApplyImportVO.getStartTime())) {
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
studentApplyImportErrorVO.setErrorMsg(baseMag + "有效结束时间为空");
}
return studentApplyImportErrorVO;
}
}

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yida.data.school.transaction.mapper.EduStudentApplyMapper">
<select id="getStudentApplyStatus"
resultType="com.yida.data.common.core.entity.apply.EduStudentApply">
select *
from edu_student_apply
where student_id = #{studentId}
and apply_code = #{applyCode}
order by end_time desc
</select>
<select id="listStudentApply" resultType="com.yida.data.common.core.entity.apply.EduStudentApply">
SELECT esa.*,
CONCAT(
school.DEPT_NAME,
'/',
section.DEPT_NAME,
'/',
campus.DEPT_NAME,
'/',
grade.DEPT_NAME,
'/',
class.DEPT_NAME
) deptName,es.stu_name studentName
from edu_student_apply esa
LEFT JOIN edu_student es ON esa.student_id = es.id
LEFT JOIN t_dept school ON es.school_id = school.DEPT_ID
LEFT JOIN edu_user_dept section ON es.section_id = section.DEPT_ID
LEFT JOIN edu_user_dept campus ON es.campus_id = campus.DEPT_ID
LEFT JOIN edu_user_dept grade ON es.grade_id = grade.DEPT_ID
LEFT JOIN edu_user_dept class ON es.class_id = class.DEPT_ID
WHERE esa.del_flag = 0
<if test="studentName!=null and studentName!=''">
and es.stu_name LIKE CONCAT('%',#{studentName},'%')
</if>
<if test="studentNumber!=null and studentNumber!=''">
and es.stu_number LIKE CONCAT('%',#{studentNumber},'%')
</if>
<if test="schoolId!=null">
and es.school_id LIKE CONCAT('%',#{schoolId},'%')
</if>
<if test="sectionId!=null">
and es.section_id LIKE CONCAT('%',#{sectionId},'%')
</if>
<if test="campusId!=null">
and es.campus_id LIKE CONCAT('%',#{campusId},'%')
</if>
<if test="gradeId!=null">
and es.grade_id LIKE CONCAT('%',#{gradeId},'%')
</if>
<if test="classId!=null">
and es.class_id LIKE CONCAT('%',#{classId},'%')
</if>
order by create_date desc
</select>
</mapper>