Browse Source

项目新增字段 ,

zyh
zhanyunjiu 3 years ago
parent
commit
afcecc3c73
  1. 93
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java
  2. 16
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectBaseVO.java
  3. 23
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectExcelVO.java
  4. 33
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectPageReqVO.java
  5. 20
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectSearchPageReqVO.java
  6. 29
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/project/ProjectDO.java
  7. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/area/AreaMapper.java
  8. 22
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java

93
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java

@ -1,13 +1,11 @@
package cn.iocoder.yudao.module.farm.annotation;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.farm.controller.admin.task.dto.TaskAssemblyDTO;
import cn.iocoder.yudao.module.farm.controller.admin.task.dto.TaskDetailDTO;
import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.discuss.DiscussDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.logMsg.LogMsgDO;
@ -25,21 +23,20 @@ import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.CpUser.CpUserMapper;
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpMessageService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpAppChatMessage;
import me.chanjar.weixin.cp.bean.message.WxCpMessage;
import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
import me.chanjar.weixin.cp.bean.messagebuilder.MiniProgramNoticeMsgBuilder;
import me.chanjar.weixin.cp.tp.message.WxCpTpMessageHandler;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
@ -79,6 +76,9 @@ public class FarmMsgAspect {
@Value("${wxma.app_id}")
private String appid;
@Value("${spring.profiles.active}")
private String active;
/**
* 定义切入点 @PointCut
* 使用了@FarmMsg注解的地方切入
@ -90,51 +90,50 @@ public class FarmMsgAspect {
@Around("farmMsgPointCut(farmMsg)")
public Object doAround(ProceedingJoinPoint pjp,FarmMsg farmMsg) throws Throwable {
Object object = pjp.proceed();
if (object instanceof CommonResult){
// 只处理接口正常result
if (farmMsg.type() == FarmMsgTypeEnum.NONE
|| farmMsg.operation() == FarmMsgTypeEnum.NONE
|| ((CommonResult<?>) object).getCode()!=0 ){
return object;
}
if (farmMsg.type() == FarmMsgTypeEnum.PROJECT || farmMsg.type() == FarmMsgTypeEnum.TASK){
//处理所需要数据
MethodSignature signature = (MethodSignature) pjp.getSignature();
Method method = signature.getMethod();
FarmMsgDTO farmMsgDTO = this.assembleMsg(method, pjp.getArgs(), (CommonResult<?>) object);
if (farmMsgDTO.getNoSendMsg()){
//草稿不发送
if (active.equalsIgnoreCase("prod")){
if (object instanceof CommonResult){
// 只处理接口正常result
if (farmMsg.type() == FarmMsgTypeEnum.NONE
|| farmMsg.operation() == FarmMsgTypeEnum.NONE
|| ((CommonResult<?>) object).getCode()!=0 ){
return object;
}
//创建 更新 删除 发送信息
if (farmMsg.operation().equals(FarmMsgTypeEnum.CREATE) || farmMsg.operation().equals(FarmMsgTypeEnum.UPDATE)
|| farmMsg.operation().equals(FarmMsgTypeEnum.DELETE)){
//接受消息的人
String toUserStr = this.assembleCpUserId(farmMsg.type(), farmMsgDTO.getId());
//发起人
AdminUserDO adminUser = adminUserMapper.selectOne(AdminUserDO::getId, getLoginUserId());
CpUserDO user = cpUserMapper.selectOne(CpUserDO::getUserId, adminUser.getCpUserId());
// if (!toUserStr.contains("WeiLaiKeQi")){
// return object;
// }
if (!farmMsgDTO.getNoSendMsg()){
//企业微信小程序通知消息
this.sendMiniMsg(user, farmMsgDTO, toUserStr);
if (farmMsg.type() == FarmMsgTypeEnum.PROJECT || farmMsg.type() == FarmMsgTypeEnum.TASK){
//处理所需要数据
MethodSignature signature = (MethodSignature) pjp.getSignature();
Method method = signature.getMethod();
FarmMsgDTO farmMsgDTO = this.assembleMsg(method, pjp.getArgs(), (CommonResult<?>) object);
if (farmMsgDTO.getNoSendMsg()){
//草稿不发送
return object;
}
}
//创建 更新 删除 发送信息
if (farmMsg.operation().equals(FarmMsgTypeEnum.CREATE) || farmMsg.operation().equals(FarmMsgTypeEnum.UPDATE)
|| farmMsg.operation().equals(FarmMsgTypeEnum.DELETE)){
//接受消息的人
String toUserStr = this.assembleCpUserId(farmMsg.type(), farmMsgDTO.getId());
//发起人
AdminUserDO adminUser = adminUserMapper.selectOne(AdminUserDO::getId, getLoginUserId());
CpUserDO user = cpUserMapper.selectOne(CpUserDO::getUserId, adminUser.getCpUserId());
//插入日志
LogMsgDO logMsgDO = LogMsgDO.builder()
.type(farmMsgDTO.getType().getDesc())
.operation(farmMsgDTO.getOperation().getDesc())
.title(farmMsgDTO.getTitle())
.msg(farmMsgDTO.getMsg())
.userId(getLoginUserId())
.build();
logMsgMapper.insert(logMsgDO);
if (!farmMsgDTO.getNoSendMsg()){
//企业微信小程序通知消息
this.sendMiniMsg(user, farmMsgDTO, toUserStr);
}
}
//插入日志
LogMsgDO logMsgDO = LogMsgDO.builder()
.type(farmMsgDTO.getType().getDesc())
.operation(farmMsgDTO.getOperation().getDesc())
.title(farmMsgDTO.getTitle())
.msg(farmMsgDTO.getMsg())
.userId(getLoginUserId())
.build();
logMsgMapper.insert(logMsgDO);
}
}
}
return object;

16
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectBaseVO.java

@ -42,6 +42,9 @@ ProjectBaseVO extends ProjectDO {
@ApiModelProperty("父级区域")
private JSONArray areas;
@ApiModelProperty("种植面积")
private Double plantArea;
private Long cropId;
@ApiModelProperty("成员选择")
@ -50,11 +53,20 @@ ProjectBaseVO extends ProjectDO {
@ApiModelProperty(value = "项目图片")
private JSONArray images;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "育苗日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date growSeedTime;
@ApiModelProperty(value = "种植日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date plantTime;
@ApiModelProperty(value = "采收开始日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date planStartTime;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "种植结束日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date planEndTime;

23
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectExcelVO.java

@ -1,13 +1,12 @@
package cn.iocoder.yudao.module.farm.controller.admin.project.vo;
import cn.hutool.json.JSON;
import cn.iocoder.yudao.module.farm.enums.ProjectStateEnum;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONArray;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.alibaba.excel.annotation.ExcelProperty;
import java.util.Date;
/**
* 农场项目 Excel VO
@ -30,6 +29,10 @@ public class ProjectExcelVO {
private ProjectStateEnum state;
private JSONArray areas;
@ApiModelProperty("种植面积")
private Double plantArea;
private JSONArray members;
private Long cropId;
@ -37,10 +40,16 @@ public class ProjectExcelVO {
@ExcelProperty("项目图片")
private JSONArray images;
@ExcelProperty("")
@ExcelProperty("育苗日期")
private Date growSeedTime;
@ExcelProperty("种植日期")
private Date plantTime;
@ExcelProperty("采收开始日期")
private Date planStartTime;
@ExcelProperty("")
@ExcelProperty("种植结束日期")
private Date planEndTime;
@ExcelProperty("")

33
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectPageReqVO.java

@ -1,14 +1,17 @@
package cn.iocoder.yudao.module.farm.controller.admin.project.vo;
import cn.hutool.json.JSON;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.farm.enums.ProjectStateEnum;
import com.alibaba.fastjson.JSONArray;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 农场项目分页 Request VO")
@ -26,6 +29,10 @@ public class ProjectPageReqVO extends PageParam {
private ProjectStateEnum state;
private JSONArray areas;
@ApiModelProperty("种植面积")
private Double plantArea;
private JSONArray members;
private Long cropId;
@ -33,6 +40,22 @@ public class ProjectPageReqVO extends PageParam {
@ApiModelProperty(value = "项目图片")
private JSONArray images;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "育苗开始日期")
private Date beginGrowSeedTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "育苗结束日期")
private Date endGrowSeedTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "种植开始日期")
private Date beginPlantTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "种植结束日期")
private Date endPlantTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始")
private Date beginPlanStartTime;

20
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectSearchPageReqVO.java

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.farm.controller.admin.project.vo;
import cn.hutool.json.JSON;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.farm.enums.ProjectStateEnum;
import com.alibaba.fastjson.JSONArray;
@ -32,6 +31,9 @@ public class ProjectSearchPageReqVO extends PageParam {
private JSONArray areas;
@ApiModelProperty("种植面积")
private Double plantArea;
private Long cropId;
private JSONArray members;
@ -39,6 +41,22 @@ public class ProjectSearchPageReqVO extends PageParam {
@ApiModelProperty(value = "")
private JSONArray images;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "育苗开始日期")
private LocalDateTime beginGrowSeedTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "育苗结束日期")
private LocalDateTime endGrowSeedTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "种植开始日期")
private LocalDateTime beginPlantTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "种植结束日期")
private LocalDateTime endPlantTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始")
private LocalDateTime beginPlanStartTime;

29
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/project/ProjectDO.java

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.farm.dal.dataobject.project;
import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.farm.enums.ProjectStateEnum;
@ -8,14 +9,19 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dict.Dict;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Maps;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* 农场项目 DO
@ -51,6 +57,9 @@ public class ProjectDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray areas;
@ApiModelProperty("种植面积")
private Double plantArea;
private Long cropId;
@ApiModelProperty("成员选择")
@ -62,12 +71,22 @@ public class ProjectDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray images;
/**
*
* 育苗日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date growSeedTime;
/**
* 种植日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date plantTime;
/**
* 采收开始日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date planStartTime;
/**
*
* 种植结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date planEndTime;

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/area/AreaMapper.java

@ -23,7 +23,7 @@ public interface AreaMapper extends BaseMapperX<AreaDO> {
.likeIfPresent(AreaDO::getName, reqVO.getName())
.eqIfPresent(AreaDO::getParentId, reqVO.getParentId())
.betweenIfPresent(AreaDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
// .eqIfPresent(AreaDO::getPretendDelete, reqVO.getPretendDelete())
.eqIfPresent(AreaDO::getPretendDelete, reqVO.getPretendDelete())
.orderByDesc(AreaDO::getId));
}

22
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java

@ -1,19 +1,23 @@
package cn.iocoder.yudao.module.farm.service.area;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.farm.controller.admin.area.vo.*;
import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.farm.controller.admin.area.vo.AreaCreateReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.area.vo.AreaExportReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.area.vo.AreaPageReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.area.vo.AreaUpdateReqVO;
import cn.iocoder.yudao.module.farm.convert.area.AreaConvert;
import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.farm.dal.mysql.area.AreaMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.AREA_NOT_EXISTS;
/**
* Service 实现类

Loading…
Cancel
Save