fix: 攀枝花东区-缴费处理mag-app
This commit is contained in:
parent
6bef534d7d
commit
57fdd2c63d
13
Readme.md
13
Readme.md
@ -1,6 +1,15 @@
|
||||
### 校园旧版
|
||||
|
||||
攀枝花东区-缴费分支
|
||||
对接新app
|
||||
对接新app-MAGAPP
|
||||
|
||||
目前需要部署:auth,gateway,mall,school,user,job,system
|
||||
目前暂时去除rabbitmq和es
|
||||
|
||||
目前需要部署:
|
||||
auth,端口:8101 中间件: ok
|
||||
gateway,端口:8300 ok
|
||||
mall,端口:9508 ok
|
||||
school,端口:9503 中间件:rabbitmq
|
||||
user,端口:9501 中间件: ok
|
||||
job,端口:8204
|
||||
system,端口:8201 中间件:es、rabbitmq
|
@ -178,9 +178,17 @@ public class SocialLoginController {
|
||||
return new FebsResponse().data(socialLoginService.appLogin(areaId, schoolId, mobile, userId, type));
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("app/getMagUserInfo")
|
||||
//@OperationLog(module = ModuleName.AUTH, methods = "获取第三方app(mag)用户信息,主要是获取手机号")
|
||||
public FebsResponse getMagUserInfo(
|
||||
@ApiParam("第三方app(mag)用户token") String appUserToken) {
|
||||
return new FebsResponse().data(socialLoginService.getMagUserInfo(appUserToken));
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("wxpublic/login")
|
||||
//@OperationLog(module = ModuleName.AUTH, methods = "app登录")
|
||||
//@OperationLog(module = ModuleName.AUTH, methods = "微信登录")
|
||||
public FebsResponse wxpublicLogin(String code, String appId,
|
||||
@ApiParam("0-教师,1-家长") Integer type,
|
||||
Long schoolId, String mobile) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yida.data.auth.service;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.yida.data.auth.entity.BindUser;
|
||||
import com.yida.data.common.core.entity.FebsResponse;
|
||||
import com.yida.data.common.core.entity.system.UserConnection;
|
||||
@ -105,4 +106,6 @@ public interface SocialLoginService {
|
||||
Map<String, Object> wxpublicLogin(String code, String appId, Integer type, Long schoolId, String mobile);
|
||||
|
||||
Map<String, Object> h5Login(Long schoolId, String mobile, Integer type);
|
||||
|
||||
JSONObject getMagUserInfo(String appUserToken);
|
||||
}
|
||||
|
@ -17,10 +17,7 @@ import com.yida.data.common.core.entity.system.*;
|
||||
import com.yida.data.common.core.entity.user.EduStaff;
|
||||
import com.yida.data.common.core.enums.RoleName;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.core.utils.WxPublicUtil;
|
||||
import com.yida.data.common.core.utils.WxUtil;
|
||||
import com.yida.data.common.core.utils.*;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.school.feign.transaction.RemoteStudentApplyService;
|
||||
import com.yida.data.system.feign.RemoteDeptService;
|
||||
@ -38,6 +35,7 @@ import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||
@ -46,10 +44,7 @@ import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswo
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author MrBird
|
||||
@ -85,6 +80,17 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
private final RemoteStudentApplyService remoteStudentApplyService;
|
||||
private final RedisService redisService;
|
||||
|
||||
/**
|
||||
* 第三方app(mag)域名
|
||||
*/
|
||||
@Value("${febs.magAppUrl}")
|
||||
private String magAppUrl;
|
||||
/**
|
||||
* 第三方app(mag)secret密钥
|
||||
*/
|
||||
@Value("${febs.magAppSecret}")
|
||||
private String magAppSecret;
|
||||
|
||||
@Override
|
||||
public AuthRequest renderAuth(String oauthType) throws FebsException {
|
||||
return factory.get(getAuthSource(oauthType));
|
||||
@ -312,7 +318,7 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
systemUser.setDeptId(type == 0 ? teacher.getSchoolId() : schoolId);
|
||||
systemUser.setRoleName(type == 0 ? RoleName.STAFF.getName() : RoleName.PARENT.getName());
|
||||
systemUser.setUserType(type == 0 ? 1 : 0);
|
||||
systemUser.setYidaAppUserId(userId);
|
||||
// systemUser.setYidaAppUserId(userId);
|
||||
userManager.registUser(systemUser);
|
||||
} else if (!systemUser.getRoleName().contains(type == 0 ? RoleName.STAFF.getName() : RoleName.PARENT.getName())) {
|
||||
Role role = roleMapper.selectOne(Wrappers.<Role>lambdaQuery()
|
||||
@ -321,12 +327,12 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
systemUser.setRoleId(systemUser.getRoleId() + "," + role.getRoleId());
|
||||
systemUser.setRoleName(systemUser.getRoleName() + "," + role.getRoleName());
|
||||
}
|
||||
// 用户未绑定appid
|
||||
if (type == 0 && teacher.getYidaAppUserId() == null) {
|
||||
remoteTeacherService.saveYidaAppUserId(teacher.getId(), userId);
|
||||
} else if (type == 1 && parent.getParentYidaAppId() == null) {
|
||||
remoteStudentService.saveYidaAppUserId(parent.getParentId(), userId);
|
||||
}
|
||||
// // 用户未绑定appid
|
||||
// if (type == 0 && teacher.getYidaAppUserId() == null) {
|
||||
// remoteTeacherService.saveYidaAppUserId(teacher.getId(), userId);
|
||||
// } else if (type == 1 && parent.getParentYidaAppId() == null) {
|
||||
// remoteStudentService.saveYidaAppUserId(parent.getParentId(), userId);
|
||||
// }
|
||||
// 登录返回token和用户信息
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
res.put("token", getOauth2AccessToken(systemUser));
|
||||
@ -579,4 +585,9 @@ public class SocialLoginServiceImpl implements SocialLoginService {
|
||||
res.put("identity", type == 0 ? teacher : parent);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getMagUserInfo(String appUserToken) {
|
||||
return MagAppUtil.getUserInfo(magAppUrl, magAppSecret, appUserToken);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.yida.data.common.core.constant;
|
||||
|
||||
/**
|
||||
* mag-app常量
|
||||
* 类
|
||||
* 多云教研室
|
||||
*
|
||||
* @author ZYJ
|
||||
*/
|
||||
public interface MagAppConstant {
|
||||
|
||||
/**
|
||||
* 获取用户信息 get请求
|
||||
* token=用户token, secret=appSecret
|
||||
* 若需要返回用户手机号(app后台需要勾选“用户授权(包含手机号)”权限)
|
||||
*/
|
||||
String GET_USER_INFO = "/mag/cloud/cloud/getUserInfo";
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.yida.data.common.core.entity.apply;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EduStudentApply {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("del_flag")
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_date", fill = FieldFill.INSERT)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createDate;
|
||||
|
||||
@TableField(value = "update_date", fill = FieldFill.UPDATE)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
private Long studentId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String studentName;
|
||||
|
||||
private String applyCode;
|
||||
|
||||
@ApiModelProperty("有效期开始时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@ApiModelProperty("有效期结束时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String deptName;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.yida.data.common.core.entity.constant;
|
||||
|
||||
public interface HaiqingConstant {
|
||||
/**
|
||||
* 增改人员消息回调返回类型
|
||||
*/
|
||||
String EDIT_PERSON_CALL = "EditPerson-Ack";
|
||||
|
||||
/**
|
||||
* 批量增加人员返回
|
||||
*/
|
||||
String ADD_PERSON_BATCH_CALL = "AddPersons-Ack";
|
||||
|
||||
/**
|
||||
* 批量修改人员返回
|
||||
*/
|
||||
String UPDATE_PERSON_BATCH_CALL = "EditPersons-Ack";
|
||||
|
||||
/**
|
||||
* 删除人员回调信息
|
||||
*/
|
||||
String DELETE_PERSON_CALL = "DelPerson";
|
||||
|
||||
/**
|
||||
* 批量删除人员信息回调
|
||||
*/
|
||||
String DELETE_PERSON_BATCH_CALL = "DeletePersons-Ack";
|
||||
|
||||
/**
|
||||
* 接收认证人员信息
|
||||
*/
|
||||
String REC_PERSON = "RecPush";
|
||||
|
||||
/**
|
||||
* 心跳消息
|
||||
*/
|
||||
String HEARTBEAT = "HeartBeat";
|
||||
/**
|
||||
* 远程开门返回信息
|
||||
*/
|
||||
String UNLOCK_ACK = "Unlock-Ack";
|
||||
/**
|
||||
* 设置系统时间
|
||||
*/
|
||||
String SET_SYS_TIME_ACK = "SetSysTime-Ack";
|
||||
|
||||
/**
|
||||
* 设备上线通知
|
||||
*/
|
||||
String ONLINE = "Online";
|
||||
|
||||
}
|
@ -33,6 +33,9 @@ public class EduParent {
|
||||
@ApiModelProperty("易达app用户id")
|
||||
private String yidaAppUserId;
|
||||
|
||||
@ApiModelProperty("mag-app用户id")
|
||||
private String magAppUserId;
|
||||
|
||||
@ApiModelProperty("微信公众号openId")
|
||||
private String wxPublicOpenId;
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
package com.yida.data.common.core.utils;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.yida.data.common.core.constant.MagAppConstant;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* mag-app工具类
|
||||
* 多云教研室
|
||||
*
|
||||
* @author ZYJ
|
||||
*/
|
||||
@Slf4j
|
||||
public class MagAppUtil {
|
||||
|
||||
/**
|
||||
* 返回的status状态码json字段名称
|
||||
*/
|
||||
public static final String STATUS_NAME = "code";
|
||||
|
||||
/**
|
||||
* 返回的data数据json字段名称
|
||||
*/
|
||||
private static final String DATA_NAME = "data";
|
||||
|
||||
/**
|
||||
* 返回的msg数据json字段名称
|
||||
*/
|
||||
private static final String MSG_NAME = "msg";
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param magAppUrl mag-app地址
|
||||
* @param magAppSecret mag-app密钥
|
||||
* @param appUserToken app用户token
|
||||
*/
|
||||
public static JSONObject getUserInfo(String magAppUrl, String magAppSecret, String appUserToken) {
|
||||
String url = magAppUrl + MagAppConstant.GET_USER_INFO;
|
||||
JSONObject body = JSONUtil.createObj().set("token", appUserToken).set("secret", magAppSecret);
|
||||
String res = HttpUtil.get(url, body);
|
||||
JSONObject resJson = JSONUtil.parseObj(res);
|
||||
log.info("mag-app获取用户信息,res:[{}],params:[{}]", res, body);
|
||||
if (!resJson.getBool("success")) {
|
||||
throw new FebsException(resJson.getStr(MSG_NAME));
|
||||
}
|
||||
return JSONUtil.parseObj(resJson.getStr(DATA_NAME));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
@ -1,156 +1,156 @@
|
||||
package com.yida.data.school.atlas.mq;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.yida.data.common.core.entity.apply.enums.DelFlagType;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagement;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetails;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsLike;
|
||||
import com.yida.data.common.core.enums.AtlasManagementRedisEnum;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsLikeMapper;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementDetailsService;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementService;
|
||||
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 图集mq接收类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/9/7
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AtlasLikeRabbitReceiver {
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
private final CoreAtlasManagementService coreAtlasManagementService;
|
||||
|
||||
private final CoreAtlasManagementDetailsService coreAtlasManagementDetailsService;
|
||||
|
||||
private final CoreAtlasManagementDetailsLikeMapper coreAtlasManagementDetailsLikeMapper;
|
||||
|
||||
/**
|
||||
* 图集mq点赞和取消赞接收处理方法
|
||||
*
|
||||
* @param coreAtlasManagementDetailsLike 接收的消息
|
||||
* @param channel channel频道
|
||||
* @param message mq的Message对象
|
||||
* @author ZYJ
|
||||
* @date 2021/9/7 13:47
|
||||
*/
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(RabbitConstant.ATLAS_LIKE_QUEUE),
|
||||
exchange = @Exchange(RabbitConstant.ATLAS_LIKE_EXCHANGE)
|
||||
))
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void atlasLikeReceiveMessage(CoreAtlasManagementDetailsLike coreAtlasManagementDetailsLike,
|
||||
Channel channel, Message message)
|
||||
throws IOException {
|
||||
log.info("接受到图集点赞相关消息: {}", JSONUtil.toJsonStr(coreAtlasManagementDetailsLike));
|
||||
log.info("开始处理消息: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
CoreAtlasManagementDetailsLike byMark =
|
||||
this.coreAtlasManagementDetailsLikeMapper.selectOne(
|
||||
new LambdaQueryWrapper<>(new CoreAtlasManagementDetailsLike())
|
||||
.eq(CoreAtlasManagementDetailsLike::getCoreAtlasManagementDetailsId, coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId())
|
||||
.eq(CoreAtlasManagementDetailsLike::getUserId, coreAtlasManagementDetailsLike.getUserId()));
|
||||
// 数据库没有点赞记录,并传过来的对象delFlag参数为0,才表示是新增操作
|
||||
if (Objects.isNull(byMark) && DelFlagType.NORMAL_TYPE.getValue().equals(coreAtlasManagementDetailsLike.getDelFlag())) {
|
||||
// 新增点赞记录
|
||||
coreAtlasManagementDetailsLikeMapper.insert(coreAtlasManagementDetailsLike);
|
||||
|
||||
// 修改图集照片或视频的点赞数+1
|
||||
CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
log.error("点赞图集作品信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() + 1);
|
||||
this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// 修改图集的点赞数+1
|
||||
CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
if (Objects.isNull(coreAtlasManagement)) {
|
||||
log.error("点赞图集信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() + 1);
|
||||
this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
// 更新redis中的数据
|
||||
redisService.hset(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
String.valueOf(coreAtlasManagementDetailsLike.getUserId()), coreAtlasManagementDetailsLike);
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
log.info("点赞消息处理完成: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
} else {
|
||||
// 取消点赞记录
|
||||
// 需要防止点赞记录还未保存,取消点赞已经先处理,需要重新放入队列
|
||||
int i = this.coreAtlasManagementDetailsLikeMapper.deleteById(coreAtlasManagementDetailsLike.getId());
|
||||
if (i == 0) {
|
||||
if (Boolean.TRUE.equals(message.getMessageProperties().getRedelivered())) {
|
||||
log.info("当前数据: {}已重新放入队列过,不再重新放入队列!", coreAtlasManagementDetailsLike.getMark());
|
||||
// 拒绝消息,并且不再重新进入队列
|
||||
//public void basicReject(long deliveryTag, boolean requeue)
|
||||
channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} else {
|
||||
log.info("重新放入队列的数据: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
//设置消息重新回到队列处理
|
||||
// requeue表示是否重新回到队列,true重新入队
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
}
|
||||
} else {
|
||||
// 修改图集照片或视频的点赞数-1
|
||||
CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
log.error("取消赞图集作品信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() - 1);
|
||||
this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// 修改图集的点赞数-1
|
||||
CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
if (Objects.isNull(coreAtlasManagement)) {
|
||||
log.error("取消赞图集信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() - 1);
|
||||
this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
redisService.hdel(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
String.valueOf(coreAtlasManagementDetailsLike.getUserId()));
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
log.info("取消赞消息处理完成: {}" + coreAtlasManagementDetailsLike.getMark());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.yida.data.school.atlas.mq;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import com.yida.data.common.core.entity.apply.enums.DelFlagType;
|
||||
//import com.yida.data.common.core.entity.atlas.CoreAtlasManagement;
|
||||
//import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetails;
|
||||
//import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsLike;
|
||||
//import com.yida.data.common.core.enums.AtlasManagementRedisEnum;
|
||||
//import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
//import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsLikeMapper;
|
||||
//import com.yida.data.school.atlas.service.CoreAtlasManagementDetailsService;
|
||||
//import com.yida.data.school.atlas.service.CoreAtlasManagementService;
|
||||
//
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
//import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
//import cn.hutool.json.JSONUtil;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
///**
|
||||
// * 图集mq接收类
|
||||
// *
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/7
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//@RequiredArgsConstructor
|
||||
//public class AtlasLikeRabbitReceiver {
|
||||
//
|
||||
// private final RedisService redisService;
|
||||
//
|
||||
// private final CoreAtlasManagementService coreAtlasManagementService;
|
||||
//
|
||||
// private final CoreAtlasManagementDetailsService coreAtlasManagementDetailsService;
|
||||
//
|
||||
// private final CoreAtlasManagementDetailsLikeMapper coreAtlasManagementDetailsLikeMapper;
|
||||
//
|
||||
// /**
|
||||
// * 图集mq点赞和取消赞接收处理方法
|
||||
// *
|
||||
// * @param coreAtlasManagementDetailsLike 接收的消息
|
||||
// * @param channel channel频道
|
||||
// * @param message mq的Message对象
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/7 13:47
|
||||
// */
|
||||
// @RabbitListener(bindings = @QueueBinding(
|
||||
// value = @Queue(RabbitConstant.ATLAS_LIKE_QUEUE),
|
||||
// exchange = @Exchange(RabbitConstant.ATLAS_LIKE_EXCHANGE)
|
||||
// ))
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public void atlasLikeReceiveMessage(CoreAtlasManagementDetailsLike coreAtlasManagementDetailsLike,
|
||||
// Channel channel, Message message)
|
||||
// throws IOException {
|
||||
// log.info("接受到图集点赞相关消息: {}", JSONUtil.toJsonStr(coreAtlasManagementDetailsLike));
|
||||
// log.info("开始处理消息: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
// CoreAtlasManagementDetailsLike byMark =
|
||||
// this.coreAtlasManagementDetailsLikeMapper.selectOne(
|
||||
// new LambdaQueryWrapper<>(new CoreAtlasManagementDetailsLike())
|
||||
// .eq(CoreAtlasManagementDetailsLike::getCoreAtlasManagementDetailsId, coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId())
|
||||
// .eq(CoreAtlasManagementDetailsLike::getUserId, coreAtlasManagementDetailsLike.getUserId()));
|
||||
// // 数据库没有点赞记录,并传过来的对象delFlag参数为0,才表示是新增操作
|
||||
// if (Objects.isNull(byMark) && DelFlagType.NORMAL_TYPE.getValue().equals(coreAtlasManagementDetailsLike.getDelFlag())) {
|
||||
// // 新增点赞记录
|
||||
// coreAtlasManagementDetailsLikeMapper.insert(coreAtlasManagementDetailsLike);
|
||||
//
|
||||
// // 修改图集照片或视频的点赞数+1
|
||||
// CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
// this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
// if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
// log.error("点赞图集作品信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() + 1);
|
||||
// this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// // 修改图集的点赞数+1
|
||||
// CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
// getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
// if (Objects.isNull(coreAtlasManagement)) {
|
||||
// log.error("点赞图集信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() + 1);
|
||||
// this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
// // 更新redis中的数据
|
||||
// redisService.hset(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
// getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
// String.valueOf(coreAtlasManagementDetailsLike.getUserId()), coreAtlasManagementDetailsLike);
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// log.info("点赞消息处理完成: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
// } else {
|
||||
// // 取消点赞记录
|
||||
// // 需要防止点赞记录还未保存,取消点赞已经先处理,需要重新放入队列
|
||||
// int i = this.coreAtlasManagementDetailsLikeMapper.deleteById(coreAtlasManagementDetailsLike.getId());
|
||||
// if (i == 0) {
|
||||
// if (Boolean.TRUE.equals(message.getMessageProperties().getRedelivered())) {
|
||||
// log.info("当前数据: {}已重新放入队列过,不再重新放入队列!", coreAtlasManagementDetailsLike.getMark());
|
||||
// // 拒绝消息,并且不再重新进入队列
|
||||
// //public void basicReject(long deliveryTag, boolean requeue)
|
||||
// channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// } else {
|
||||
// log.info("重新放入队列的数据: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
// //设置消息重新回到队列处理
|
||||
// // requeue表示是否重新回到队列,true重新入队
|
||||
// channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
// }
|
||||
// } else {
|
||||
// // 修改图集照片或视频的点赞数-1
|
||||
// CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
// this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
// if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
// log.error("取消赞图集作品信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() - 1);
|
||||
// this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// // 修改图集的点赞数-1
|
||||
// CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
// getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
// if (Objects.isNull(coreAtlasManagement)) {
|
||||
// log.error("取消赞图集信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() - 1);
|
||||
// this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
// redisService.hdel(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
// getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
// String.valueOf(coreAtlasManagementDetailsLike.getUserId()));
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// log.info("取消赞消息处理完成: {}" + coreAtlasManagementDetailsLike.getMark());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
@ -1,64 +1,39 @@
|
||||
package com.yida.data.school.atlas.service.impl;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.apply.enums.DelFlagType;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasAccessRecords;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagement;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetails;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsComment;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsCommentReply;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsLike;
|
||||
import com.yida.data.common.core.entity.atlas.*;
|
||||
import com.yida.data.common.core.enums.AtlasManagementRedisEnum;
|
||||
import com.yida.data.common.core.enums.EnableStatusEnum;
|
||||
import com.yida.data.common.core.enums.LikeMarkEnum;
|
||||
import com.yida.data.common.core.enums.WorkTypeEnum;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.rabbit.util.RabbitUtil;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasAccessRecordsMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsCommentMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsCommentReplyMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsLikeMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementMapper;
|
||||
import com.yida.data.school.atlas.mapper.*;
|
||||
import com.yida.data.school.atlas.service.AppAtlasService;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementDetailsService;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementService;
|
||||
import com.yida.data.school.dto.atlas.AtlasSelectPageDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasInfoDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentReplySaveDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentReplySelectDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentSaveDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentSelectDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkInfoDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkLikeDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkListDTO;
|
||||
import com.yida.data.school.dto.atlas.app.*;
|
||||
import com.yida.data.school.vo.atlas.AtlasSelectPageVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasInfoVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasWorkBaseVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasWorkCommentPageVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasWorkCommentReplyPageVO;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 学校图集app接口service层
|
||||
*
|
||||
@ -70,8 +45,6 @@ import lombok.RequiredArgsConstructor;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AppAtlasServiceImpl implements AppAtlasService {
|
||||
|
||||
private final RabbitUtil rabbitUtil;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
private final CoreAtlasManagementService coreAtlasManagementService;
|
||||
@ -247,8 +220,8 @@ public class AppAtlasServiceImpl implements AppAtlasService {
|
||||
+ ":" + appAtlasWorkLikeDTO.getAtlasDetailsId(),
|
||||
String.valueOf(appAtlasWorkLikeDTO.getUserId()), coreAtlasManagementDetailsLike);
|
||||
// 发送mq点赞消息
|
||||
rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
coreAtlasManagementDetailsLike);
|
||||
// rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
// coreAtlasManagementDetailsLike);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ -275,8 +248,8 @@ public class AppAtlasServiceImpl implements AppAtlasService {
|
||||
redisService.hashIncrement(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_LIKE_NUM.getValue(),
|
||||
String.valueOf(appAtlasWorkLikeDTO.getAtlasId()), -1L);
|
||||
// 发送mq取消点赞消息
|
||||
rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
detailsLike);
|
||||
// rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
// detailsLike);
|
||||
});
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
@ -1,37 +1,37 @@
|
||||
package com.yida.data.school.news.config;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.school.dto.news.SysNoticeSaveDTO;
|
||||
import com.yida.data.school.news.service.EduNoticeSystemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class NewsRabbitReceiver {
|
||||
|
||||
private final EduNoticeSystemService eduNoticeSystemService;
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(RabbitConstant.MSG_NOTICE_SYS_SAVE_QUEUE),
|
||||
exchange = @Exchange(RabbitConstant.MSG_NOTICE_SYS_SAVE_KEY)
|
||||
))
|
||||
public void receivePosition(SysNoticeSaveDTO notice, Channel channel, Message message) {
|
||||
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||
try {
|
||||
log.info("接收消息:[{}]", notice);
|
||||
eduNoticeSystemService.saveNotice(notice);
|
||||
channel.basicAck(deliveryTag, false);
|
||||
} catch (Exception e) {
|
||||
log.error("保存系统通知失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.yida.data.school.news.config;
|
||||
//
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
//import com.yida.data.school.dto.news.SysNoticeSaveDTO;
|
||||
//import com.yida.data.school.news.service.EduNoticeSystemService;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//@RequiredArgsConstructor
|
||||
//public class NewsRabbitReceiver {
|
||||
//
|
||||
// private final EduNoticeSystemService eduNoticeSystemService;
|
||||
//
|
||||
// @RabbitListener(bindings = @QueueBinding(
|
||||
// value = @Queue(RabbitConstant.MSG_NOTICE_SYS_SAVE_QUEUE),
|
||||
// exchange = @Exchange(RabbitConstant.MSG_NOTICE_SYS_SAVE_KEY)
|
||||
// ))
|
||||
// public void receivePosition(SysNoticeSaveDTO notice, Channel channel, Message message) {
|
||||
// long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||
// try {
|
||||
// log.info("接收消息:[{}]", notice);
|
||||
// eduNoticeSystemService.saveNotice(notice);
|
||||
// channel.basicAck(deliveryTag, false);
|
||||
// } catch (Exception e) {
|
||||
// log.error("保存系统通知失败", e);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
@ -8,36 +8,35 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.entity.notice.EduNoticeSystem;
|
||||
import com.yida.data.common.core.entity.notice.EduNoticeSystemUser;
|
||||
import com.yida.data.msg.dto.WebsocketMsgDTO;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.rabbit.util.RabbitUtil;
|
||||
import com.yida.data.school.dto.news.SysNoticeSaveDTO;
|
||||
import com.yida.data.school.news.mapper.EduNoticeSystemMapper;
|
||||
import com.yida.data.school.news.service.EduNoticeSystemService;
|
||||
import com.yida.data.school.news.service.EduNoticeSystemUserService;
|
||||
import com.yida.data.school.vo.news.SysNoticeInfoVO;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@RequiredArgsConstructor
|
||||
public class EduNoticeSystemServiceImpl extends ServiceImpl<EduNoticeSystemMapper, EduNoticeSystem> implements
|
||||
EduNoticeSystemService {
|
||||
EduNoticeSystemService {
|
||||
|
||||
private final EduNoticeSystemUserService eduNoticeSystemUserService;
|
||||
private final RabbitUtil rabbitUtil;
|
||||
// private final RabbitUtil rabbitUtil;
|
||||
|
||||
@Override
|
||||
public IPage<SysNoticeInfoVO> listNoticePage(Long userId, Integer pageNum, Integer pageSize) {
|
||||
IPage<SysNoticeInfoVO> res = baseMapper
|
||||
.listNoticePage(Page.of(pageNum, pageSize), userId);
|
||||
.listNoticePage(Page.of(pageNum, pageSize), userId);
|
||||
if (CollUtil.isNotEmpty(res.getRecords())) {
|
||||
eduNoticeSystemUserService.update(Wrappers.<EduNoticeSystemUser>lambdaUpdate()
|
||||
.in(EduNoticeSystemUser::getId,
|
||||
res.getRecords().stream().map(SysNoticeInfoVO::getMsgId).collect(Collectors.toList()))
|
||||
.set(EduNoticeSystemUser::getReadFlag, 1));
|
||||
.in(EduNoticeSystemUser::getId,
|
||||
res.getRecords().stream().map(SysNoticeInfoVO::getMsgId).collect(Collectors.toList()))
|
||||
.set(EduNoticeSystemUser::getReadFlag, 1));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -62,7 +61,7 @@ public class EduNoticeSystemServiceImpl extends ServiceImpl<EduNoticeSystemMappe
|
||||
WebsocketMsgDTO msg = new WebsocketMsgDTO();
|
||||
msg.setUserId(userId);
|
||||
msg.setContent(dto.getContent());
|
||||
rabbitUtil.convertAndSendMsg(RabbitConstant.MSG_EXCHANGE, RabbitConstant.MSG_WEBSOCKET_KEY, msg);
|
||||
// rabbitUtil.convertAndSendMsg(RabbitConstant.MSG_EXCHANGE, RabbitConstant.MSG_WEBSOCKET_KEY, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user