Browse Source

难点堵点

dev
sunyuchao 3 years ago
parent
commit
c40df4938e
  1. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoAttachmentDTO.java
  2. 68
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddMemoDifficultyFromDTO.java
  3. 14
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/MemoDifficultyController.java
  4. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoAttachmentEntity.java
  5. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/MemoDifficultyService.java
  6. 47
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/MemoDifficultyServiceImpl.java

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/MemoAttachmentDTO.java

@ -31,7 +31,7 @@ public class MemoAttachmentDTO implements Serializable {
private String customerId; private String customerId;
/** /**
* REMIND_MSG.ID * REMIND_MSG.ID 业务(工作日志难点堵点人员关怀)表Id
*/ */
@JsonIgnore @JsonIgnore
private String remindMsgId; private String remindMsgId;

68
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/AddMemoDifficultyFromDTO.java

@ -0,0 +1,68 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.dto.MemoAttachmentDTO;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 备忘录-难点读点
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-03-15
*/
@Data
public class AddMemoDifficultyFromDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface AddMemoDifficulty extends CustomerClientShowGroup {}
/**
* id
*/
private String id;
/**
* 内容
*/
@NotBlank(message = "难点堵点内容不能为空", groups = { AddMemoDifficulty.class })
@Length(max = 500, message = "难点堵点内容最长为50个字", groups = { AddMemoDifficulty.class })
private String content;
/**
* 解决方式
*/
private String resolveWay;
/**
* 备注
*/
private String remark;
/**
* 计划执行时间
*/
private Date scheduledTime;
/**
* 提醒时间
*/
private Date remindTime;
/**
* 附件集合
*/
private List<MemoAttachmentDTO> attachmentList;
//token中客户ID
private String customerId;
//token中用户Id
private String userId;
}

14
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/MemoDifficultyController.java

@ -1,7 +1,9 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
@ -9,6 +11,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.MemoDifficultyDTO; import com.epmet.dto.MemoDifficultyDTO;
import com.epmet.dto.form.AddMemoDifficultyFromDTO;
import com.epmet.service.MemoDifficultyService; import com.epmet.service.MemoDifficultyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -43,18 +46,17 @@ public class MemoDifficultyController {
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("save") @PostMapping("save")
public Result save(@RequestBody MemoDifficultyDTO dto){ public Result save(@LoginUser TokenDto tokenDTO, @RequestBody AddMemoDifficultyFromDTO dto){
//效验数据 ValidatorUtils.validateEntity(dto, AddMemoDifficultyFromDTO.AddMemoDifficulty.class);
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); dto.setCustomerId(tokenDTO.getCustomerId());
dto.setUserId(tokenDTO.getUserId());
memoDifficultyService.save(dto); memoDifficultyService.save(dto);
return new Result(); return new Result();
} }
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("update") @PostMapping("update")
public Result update(@RequestBody MemoDifficultyDTO dto){ public Result update(@RequestBody AddMemoDifficultyFromDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
memoDifficultyService.update(dto); memoDifficultyService.update(dto);
return new Result(); return new Result();
} }

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/MemoAttachmentEntity.java

@ -26,7 +26,7 @@ public class MemoAttachmentEntity extends BaseEpmetEntity {
private String customerId; private String customerId;
/** /**
* REMIND_MSG.ID * REMIND_MSG.ID 业务(工作日志难点堵点人员关怀)表Id
*/ */
private String remindMsgId; private String remindMsgId;

5
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/MemoDifficultyService.java

@ -3,6 +3,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.MemoDifficultyDTO; import com.epmet.dto.MemoDifficultyDTO;
import com.epmet.dto.form.AddMemoDifficultyFromDTO;
import com.epmet.entity.MemoDifficultyEntity; import com.epmet.entity.MemoDifficultyEntity;
import java.util.List; import java.util.List;
@ -54,7 +55,7 @@ public interface MemoDifficultyService extends BaseService<MemoDifficultyEntity>
* @author generator * @author generator
* @date 2022-03-15 * @date 2022-03-15
*/ */
void save(MemoDifficultyDTO dto); void save(AddMemoDifficultyFromDTO dto);
/** /**
* 默认更新 * 默认更新
@ -64,7 +65,7 @@ public interface MemoDifficultyService extends BaseService<MemoDifficultyEntity>
* @author generator * @author generator
* @date 2022-03-15 * @date 2022-03-15
*/ */
void update(MemoDifficultyDTO dto); void update(AddMemoDifficultyFromDTO dto);
/** /**
* 批量删除 * 批量删除

47
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/MemoDifficultyServiceImpl.java

@ -7,10 +7,19 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.MemoDifficultyDao; import com.epmet.dao.MemoDifficultyDao;
import com.epmet.dto.MemoAttachmentDTO;
import com.epmet.dto.MemoAttrDTO;
import com.epmet.dto.MemoDifficultyDTO; import com.epmet.dto.MemoDifficultyDTO;
import com.epmet.dto.form.AddMemoDifficultyFromDTO;
import com.epmet.entity.MemoAttachmentEntity;
import com.epmet.entity.MemoAttrEntity;
import com.epmet.entity.MemoDifficultyEntity; import com.epmet.entity.MemoDifficultyEntity;
import com.epmet.service.MemoAttachmentService;
import com.epmet.service.MemoAttrService;
import com.epmet.service.MemoDifficultyService; import com.epmet.service.MemoDifficultyService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -26,6 +35,10 @@ import java.util.Map;
*/ */
@Service @Service
public class MemoDifficultyServiceImpl extends BaseServiceImpl<MemoDifficultyDao, MemoDifficultyEntity> implements MemoDifficultyService { public class MemoDifficultyServiceImpl extends BaseServiceImpl<MemoDifficultyDao, MemoDifficultyEntity> implements MemoDifficultyService {
@Autowired
private MemoAttrService memoAttrService;
@Autowired
private MemoAttachmentService memoAttachmentService;
@Override @Override
@ -61,16 +74,46 @@ public class MemoDifficultyServiceImpl extends BaseServiceImpl<MemoDifficultyDao
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(MemoDifficultyDTO dto) { public void save(AddMemoDifficultyFromDTO dto) {
//1.新增难点堵点数据
MemoDifficultyEntity entity = ConvertUtils.sourceToTarget(dto, MemoDifficultyEntity.class); MemoDifficultyEntity entity = ConvertUtils.sourceToTarget(dto, MemoDifficultyEntity.class);
insert(entity); insert(entity);
//2.新增备忘录记录数据
MemoAttrEntity memoAttr = new MemoAttrEntity();
memoAttr.setId(entity.getCustomerId());
memoAttr.setCustomerId(dto.getCustomerId());
memoAttr.setRemindTime(dto.getRemindTime());
memoAttr.setType("difficulty");
memoAttr.setReceiver(dto.getUserId());
memoAttrService.insert(memoAttr);
//3.新增难点堵点附件数据
if(CollectionUtils.isNotEmpty(dto.getAttachmentList())){
List<MemoAttachmentEntity> list = ConvertUtils.sourceToTarget(dto.getAttachmentList(), MemoAttachmentEntity.class);
list.forEach(l->l.setRemindMsgId(entity.getId()));
memoAttachmentService.insertBatch(list);
}
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(MemoDifficultyDTO dto) { public void update(AddMemoDifficultyFromDTO dto) {
//1.更新难点堵点主表数据
MemoDifficultyEntity entity = ConvertUtils.sourceToTarget(dto, MemoDifficultyEntity.class); MemoDifficultyEntity entity = ConvertUtils.sourceToTarget(dto, MemoDifficultyEntity.class);
updateById(entity); updateById(entity);
//2.附件表数据全删全增
memoAttachmentService.deleteByMemoId(dto.getId());
if(CollectionUtils.isNotEmpty(dto.getAttachmentList())){
List<MemoAttachmentEntity> list = ConvertUtils.sourceToTarget(dto.getAttachmentList(), MemoAttachmentEntity.class);
list.forEach(l->l.setRemindMsgId(entity.getId()));
memoAttachmentService.insertBatch(list);
}
//3.判断更新提醒记录表提醒时间
if(null != dto.getRemindTime()){
MemoAttrDTO memoAttr = new MemoAttrDTO();
memoAttr.setId(dto.getId());
memoAttr.setRemindTime(dto.getRemindTime());
memoAttrService.update(memoAttr);
}
} }
@Override @Override

Loading…
Cancel
Save