Browse Source

Merge remote-tracking branch 'origin/dev_party_helper'

master
yinzuomei 3 years ago
parent
commit
a3a603c655
  1. 1
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml
  2. 1
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointResultDTO.java
  3. 67
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  4. 8
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcScheduleDTO.java
  5. 2
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java
  6. 3
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/AddOrEditScheduleFormDTO.java
  7. 2
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/HomeMonthTotalFormDTO.java
  8. 38
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcScheduleFormDTO.java
  9. 1
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java
  10. 71
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcScheduleListDTO.java
  11. 68
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcScheduleController.java
  12. 5
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcScheduleDao.java
  13. 5
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcScheduleEntity.java
  14. 26
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcScheduleListExcel.java
  15. 17
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcScheduleService.java
  16. 38
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java
  17. 49
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java
  18. 1
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.9__schedule_time.sql
  19. 73
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml

1
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml

@ -12,6 +12,7 @@
del_flag = '0'
AND customer_id = #{customerId}
AND user_id = #{userId}
ORDER BY CREATED_TIME desc
</select>
<update id="upByUserId" parameterType="com.epmet.dto.form.ReadIcMessageFormDTO">

1
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointResultDTO.java

@ -25,6 +25,7 @@ public class PartyPointResultDTO implements Serializable {
private String time;
private String point;
private String actId;
private String actTopic;
private String actType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date actDate;

67
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java

@ -623,39 +623,43 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
@Override
public List<PartyPointRecordResultDTO> pagePartyPoint(PartyPointFormDTO formDTO) {
List<PartyPointRecordResultDTO> result = new LinkedList<>();
if (StringUtils.isNotBlank(formDTO.getQuarter())) {
if (StringUtils.isNotBlank(formDTO.getMonth())) {
if (StringUtils.isNotBlank(formDTO.getYear())) {
if (StringUtils.isNotBlank(formDTO.getQuarter())) {
if (StringUtils.isNotBlank(formDTO.getMonth())) {
formDTO.setStartDate(formDTO.getYear().concat(formDTO.getMonth()));
formDTO.setDateType(NumConstant.TWO_STR);
} else {
switch (formDTO.getQuarter()) {
case NumConstant.ONE_STR:
formDTO.setStartDate(formDTO.getYear().concat("01"));
formDTO.setEndDate(formDTO.getYear().concat("03"));
break;
case NumConstant.TWO_STR:
formDTO.setStartDate(formDTO.getYear().concat("04"));
formDTO.setEndDate(formDTO.getYear().concat("06"));
break;
case NumConstant.THREE_STR:
formDTO.setStartDate(formDTO.getYear().concat("07"));
formDTO.setEndDate(formDTO.getYear().concat("09"));
break;
case NumConstant.FOUR_STR:
formDTO.setStartDate(formDTO.getYear().concat("10"));
formDTO.setEndDate(formDTO.getYear().concat("12"));
break;
default:
break;
}
formDTO.setDateType(NumConstant.THREE_STR);
}
} else if (StringUtils.isNotBlank(formDTO.getMonth())) {
formDTO.setStartDate(formDTO.getYear().concat(formDTO.getMonth()));
formDTO.setDateType(NumConstant.TWO_STR);
} else {
switch (formDTO.getQuarter()) {
case NumConstant.ONE_STR:
formDTO.setStartDate(formDTO.getYear().concat("01"));
formDTO.setEndDate(formDTO.getYear().concat("03"));
break;
case NumConstant.TWO_STR:
formDTO.setStartDate(formDTO.getYear().concat("04"));
formDTO.setEndDate(formDTO.getYear().concat("06"));
break;
case NumConstant.THREE_STR:
formDTO.setStartDate(formDTO.getYear().concat("07"));
formDTO.setEndDate(formDTO.getYear().concat("09"));
break;
case NumConstant.FOUR_STR:
formDTO.setStartDate(formDTO.getYear().concat("10"));
formDTO.setEndDate(formDTO.getYear().concat("12"));
break;
default:
break;
}
formDTO.setDateType(NumConstant.THREE_STR);
formDTO.setStartDate(formDTO.getYear());
formDTO.setDateType(NumConstant.ONE_STR);
}
} else if (StringUtils.isNotBlank(formDTO.getMonth())){
formDTO.setStartDate(formDTO.getYear().concat(formDTO.getMonth()));
formDTO.setDateType(NumConstant.TWO_STR);
} else {
formDTO.setStartDate(formDTO.getYear());
formDTO.setDateType(NumConstant.ONE_STR);
formDTO.setDateType(NumConstant.FOUR_STR);
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<PartyPointResultDTO> list =baseDao.getPagePartyPoint(formDTO);
@ -666,6 +670,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
item.setActType(actInfo.getData().getActTypeName());
item.setActAddress(actInfo.getData().getAddress());
item.setActDate(actInfo.getData().getHoldTime());
item.setActTopic(actInfo.getData().getTopic());
}
});
@ -675,10 +680,10 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
Map<String, List<PartyPointResultDTO>> sortedMap = Maps.newLinkedHashMap();
map.entrySet().stream().sorted(Map.Entry.<String, List<PartyPointResultDTO>>comparingByKey().reversed())
.forEachOrdered(e -> sortedMap.put(e.getKey(), e.getValue()));
sortedMap.entrySet().forEach(e -> {
sortedMap.forEach((key, value) -> {
PartyPointRecordResultDTO o = new PartyPointRecordResultDTO();
o.setDate(e.getKey());
o.setDailyList(e.getValue());
o.setDate(key);
o.setDailyList(value);
result.add(o);
});

8
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcScheduleDTO.java

@ -1,8 +1,9 @@
package com.epmet.resi.partymember.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -56,6 +57,11 @@ public class IcScheduleDTO implements Serializable {
*/
private Date remindTime;
/**
* 发生时间
*/
private Date happenedTime;
/**
* 是否公开0仅自己可见1组织内其他人可见
*/

2
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java

@ -73,7 +73,7 @@ public class IcPartyActAddOrUpdateFormDTO implements Serializable {
* 活动主题
*/
@NotBlank(message = "活动主题不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
@Length(max = 35, message = "最多输入35个字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
@Length(max = 35, message = "活动主题最多输入35个字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String topic;
/**

3
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/AddOrEditScheduleFormDTO.java

@ -41,6 +41,9 @@ public class AddOrEditScheduleFormDTO implements Serializable {
@NotBlank(message = "isPublic不能为空",groups = AddScheduleForm.class)
private String isPublic;
@NotNull(message = "happenedTime不能为空",groups = AddScheduleForm.class)
private Date happenedTime;
/**
* 备注500字
*/

2
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/HomeMonthTotalFormDTO.java

@ -44,5 +44,5 @@ public class HomeMonthTotalFormDTO implements Serializable {
*/
private String agencyId;
private String path;
// private String path;
}

38
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcScheduleFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.resi.partymember.dto.partyOrg.form;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
public class IcScheduleFormDTO implements Serializable {
/**
* 日程标题
*/
private String title;
/**
* 是否公开0仅自己可见1组织内其他人可见
*/
private String isPublic;
/**
* 提醒开始时间
*/
private String startTime;
/**
* 提醒结束时间
*/
private String endTime;
private Integer pageNo = 1;
private Integer pageSize = 20;
private Boolean isPage = true;
private String agencyId;
//token中信息
private String customerId;
private String staffId;
}

1
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java

@ -61,6 +61,7 @@ public class ActAndScheduleListResultDTO implements Serializable {
private String scheduleId;
private String title;
private String remindTime;
private String happenedTime;
private String remark;
private Boolean isMe = false;
private String staffId;

71
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcScheduleListDTO.java

@ -0,0 +1,71 @@
package com.epmet.resi.partymember.dto.partyOrg.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 日程表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-08-18
*/
@Data
public class IcScheduleListDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 当前登录用户userId
*/
private String staffId;
/**
* 日程标题35字
*/
private String title;
/**
* 提醒时间其实就是日程所属日期
*/
private Date remindTime;
private Date happenedTime;
/**
* 提醒时间其实就是日程所属日期
*/
private String remindTimeName;
/**
* 是否公开0仅自己可见1组织内其他人可见
*/
private String isPublic;
/**
* 是否公开0 1
*/
private String isPublicName;
/**
* 备注500字
*/
private String remark;
/**
* 创建时间
*/
private Date createdTime;
}

68
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcScheduleController.java

@ -1,23 +1,42 @@
package com.epmet.modules.partyOrg.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.modules.partyOrg.excel.IcScheduleListExcel;
import com.epmet.modules.partyOrg.service.IcScheduleService;
import com.epmet.resi.partymember.dto.IcScheduleDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
@ -28,15 +47,17 @@ import java.util.Map;
*/
@RestController
@RequestMapping("icSchedule")
@Slf4j
public class IcScheduleController {
@Autowired
private IcScheduleService icScheduleService;
@RequestMapping("page")
public Result<PageData<IcScheduleDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcScheduleDTO> page = icScheduleService.page(params);
return new Result<PageData<IcScheduleDTO>>().ok(page);
@RequestMapping(value = "list",method = {RequestMethod.POST,RequestMethod.GET})
public Result<PageData<IcScheduleListDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody IcScheduleFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
return new Result<PageData<IcScheduleListDTO>>().ok(icScheduleService.list(formDTO));
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
@ -98,5 +119,42 @@ public class IcScheduleController {
icScheduleService.delSchedule(scheduleIds);
return new Result();
}
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody IcScheduleFormDTO formDTO, HttpServletResponse response) throws IOException {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
formDTO.setIsPage(false);
ExcelWriter excelWriter = null;
formDTO.setPageNo(NumConstant.ONE);
formDTO.setPageSize(NumConstant.TEN_THOUSAND);
try {
String fileName = "日程列表" + DateUtils.format(new Date()) + ".xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcScheduleListExcel.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build();
PageData<IcScheduleListDTO> data = null;
List<IcScheduleListExcel> list = null;
do {
data = icScheduleService.list(formDTO);
list = ConvertUtils.sourceToTarget(data.getList(), IcScheduleListExcel.class);
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
excelWriter.write(list, writeSheet);
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize());
} catch (EpmetException e) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setHeader("content-type", "application/json; charset=UTF-8");
PrintWriter printWriter = response.getWriter();
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg());
printWriter.write(JSON.toJSONString(result));
printWriter.close();
} catch (Exception e) {
log.error("export exception", e);
} finally {
if (excelWriter != null) {
excelWriter.finish();
}
}
}
}

5
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcScheduleDao.java

@ -5,8 +5,10 @@ import com.epmet.modules.partyOrg.entity.IcScheduleEntity;
import com.epmet.resi.partymember.dto.partyOrg.form.ActAndScheduleListFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.HomeMonthTotalFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.ActAndScheduleListResultDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.HomeMonthTotalResultDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -26,4 +28,7 @@ public interface IcScheduleDao extends BaseDao<IcScheduleEntity> {
List<ActAndScheduleListResultDTO.ScheduleListDTO> getScheduleList(ActAndScheduleListFormDTO formDTO);
List<IcScheduleListDTO> selectScheduleList(IcScheduleFormDTO formDTO);
List<IcScheduleEntity> selectNeedNotice(String dateId);
}

5
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcScheduleEntity.java

@ -56,6 +56,11 @@ public class IcScheduleEntity extends BaseEpmetEntity {
*/
private Date remindTime;
/**
* 发生时间
*/
private Date happenedTime;
/**
* 是否公开0仅自己可见1组织内其他人可见
*/

26
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcScheduleListExcel.java

@ -0,0 +1,26 @@
package com.epmet.modules.partyOrg.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
@Data
public class IcScheduleListExcel {
@ExcelProperty(value = "日程标题")
@ColumnWidth(20)
private String title;
@ExcelProperty(value = "提醒时间")
@ColumnWidth(20)
private String remindTimeName;
@ExcelProperty(value = "是否公开")
@ColumnWidth(20)
private String isPublicName;
@ExcelProperty(value = "备注")
@ColumnWidth(25)
private String remark;
}

17
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcScheduleService.java

@ -5,9 +5,10 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.modules.partyOrg.entity.IcScheduleEntity;
import com.epmet.resi.partymember.dto.IcScheduleDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO;
import java.util.List;
import java.util.Map;
/**
* 日程表
@ -17,25 +18,15 @@ import java.util.Map;
*/
public interface IcScheduleService extends BaseService<IcScheduleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<IcScheduleDTO>
* @author generator
* @date 2022-08-18
*/
PageData<IcScheduleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @param formDTO
* @return java.util.List<IcScheduleDTO>
* @author generator
* @date 2022-08-18
*/
List<IcScheduleDTO> list(Map<String, Object> params);
PageData<IcScheduleListDTO> list(IcScheduleFormDTO formDTO);
/**
* 单条查询

38
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java

@ -84,7 +84,8 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
private IcPartyMemberDao icPartyMemberDao;
@Autowired
private IcPartyActSignInRecordDao icPartyActSignInRecordDao;
@Autowired
private IcScheduleDao icScheduleDao;
/**
* 活动类型列表
*
@ -122,11 +123,11 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
public List<HomeMonthTotalResultDTO> getHomeMonthTotal(HomeMonthTotalFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo = queryStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId());
if (null == icPartyOrgDTO){
throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId());
}
formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId()));
// IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId());
// if (null == icPartyOrgDTO){
// throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId());
// }
// formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId()));
List<HomeMonthTotalResultDTO> result = constructMonthData(formDTO.getYearId());
List<HomeMonthTotalResultDTO> countList = scheduleDao.getScheduleAndActCount(formDTO);
if (CollectionUtils.isNotEmpty(countList)){
@ -306,7 +307,7 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
public IcPartyActDetailResDTO queryActDetail(String customerId, String userId, String icPartyActId) {
IcPartyActEntity icPartyActEntity = baseDao.selectById(icPartyActId);
if (null == icPartyActEntity) {
String msg = "未找到活动详情";
String msg = "活动已删除";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
}
IcPartyActDetailResDTO resDTO=ConvertUtils.sourceToTarget(icPartyActEntity,IcPartyActDetailResDTO.class);
@ -522,14 +523,16 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
if (!"notify".equals(formDTO.getType())) {
entity = baseDao.selectById(formDTO.getIcPartyActId());
if (null == entity) {
String msg = "活动信息不存在,活动Id:" + formDTO.getIcPartyActId();
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg);
// String msg = "活动信息不存在,活动Id:" + formDTO.getIcPartyActId();
// throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg);
return;
}
} else {
schedule = scheduleDao.selectById(formDTO.getIcPartyActId());
if (null == schedule) {
String msg = "日程信息不存在,活动Id:" + formDTO.getIcPartyActId();
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg);
// String msg = "日程信息不存在,活动Id:" + formDTO.getIcPartyActId();
// throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg);
return;
}
}
@ -611,7 +614,7 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
msg.setTitle("您有一个日程提醒");
msg.setReadFlag(ReadFlagConstant.UN_READ);
StringBuffer str = new StringBuffer();
str.append("日程:").append(schedule.getTitle()).append("\n").append("时间:").append(DateUtils.format(schedule.getRemindTime(), "yyyy年MM月dd日 HH:mm:ss"));
str.append("日程:").append(schedule.getTitle()).append("\n").append("时间:").append(DateUtils.format(schedule.getHappenedTime(), "yyyy年MM月dd日 HH:mm:ss"));
msg.setMessageContent(str.toString());
msg.setMessageType("party");
msg.setTargetId(formDTO.getIcPartyActId());
@ -727,6 +730,17 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
.openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class))
.sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg);
}
//日程又增加了一个提醒时间
List<IcScheduleEntity> scheduleEntityList=icScheduleDao.selectNeedNotice(dateId);
for(IcScheduleEntity icScheduleEntity:scheduleEntityList){
PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg();
msg.setCustomerId(icScheduleEntity.getCustomerId());
msg.setIcPartyActId(icScheduleEntity.getId());
msg.setType("notify");
SendMqMsgUtil.build()
.openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class))
.sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg);
}
}
/**

49
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java

@ -1,9 +1,7 @@
package com.epmet.modules.partyOrg.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.PartyMeetingMessageMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
@ -12,15 +10,15 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.constant.SystemMessageType;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.modules.partyOrg.dao.IcScheduleDao;
import com.epmet.modules.partyOrg.entity.IcScheduleEntity;
import com.epmet.modules.partyOrg.service.IcScheduleService;
import com.epmet.resi.partymember.dto.IcScheduleDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -39,20 +37,20 @@ import java.util.Map;
@Service
public class IcScheduleServiceImpl extends BaseServiceImpl<IcScheduleDao, IcScheduleEntity> implements IcScheduleService {
@Override
public PageData<IcScheduleDTO> page(Map<String, Object> params) {
IPage<IcScheduleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, IcScheduleDTO.class);
}
@Override
public List<IcScheduleDTO> list(Map<String, Object> params) {
List<IcScheduleEntity> entityList = baseDao.selectList(getWrapper(params));
public PageData<IcScheduleListDTO> list(IcScheduleFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
//获取工作人员所属组织信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getStaffId()));
}
formDTO.setAgencyId(staffInfo.getAgencyId());
return ConvertUtils.sourceToTarget(entityList, IcScheduleDTO.class);
List<IcScheduleListDTO> list = baseDao.selectScheduleList(formDTO);
PageInfo<IcScheduleListDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
private QueryWrapper<IcScheduleEntity> getWrapper(Map<String, Object> params){
@ -115,15 +113,16 @@ public class IcScheduleServiceImpl extends BaseServiceImpl<IcScheduleDao, IcSche
IcScheduleEntity e = ConvertUtils.sourceToTarget(formDTO, IcScheduleEntity.class);
e.setOrgId(staffInfo.getAgencyId());
e.setPid(agencyInfo.getPid());
e.setOrgIdPath("".equals(agencyInfo.getPids()) ? "" : agencyInfo.getPids().concat(":").concat(agencyInfo.getId()));
e.setOrgIdPath("".equals(agencyInfo.getPids()) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId()));
baseDao.insert(e);
PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg();
msg.setCustomerId(formDTO.getCustomerId());
msg.setIcPartyActId(e.getId());
msg.setType("notify");
SendMqMsgUtil.build()
.openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class))
.sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg);
// PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg();
// msg.setCustomerId(formDTO.getCustomerId());
// msg.setIcPartyActId(e.getId());
// msg.setType("notify");
// SendMqMsgUtil.build()
// .openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class))
// .sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg);
}
/**

1
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.9__schedule_time.sql

@ -0,0 +1 @@
ALTER TABLE ic_schedule ADD COLUMN HAPPENED_TIME datetime not null COMMENT '发生时间' AFTER REMIND_TIME;

73
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml

@ -21,14 +21,14 @@
FROM
(SELECT
COUNT(id) as count,
DATE_FORMAT(CREATED_TIME,'%Y%m') as monthId
DATE_FORMAT(HAPPENED_TIME,'%Y%m') as monthId
FROM ic_schedule
WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(REMIND_TIME,'%Y') = #{yearId}
AND DATE_FORMAT(HAPPENED_TIME,'%Y') = #{yearId}
AND ORG_ID_PATH LIKE CONCAT('%',#{agencyId},'%')
AND (IS_PUBLIC = '1' OR (STAFF_ID = #{staffId} AND IS_PUBLIC = '0'))
GROUP BY DATE_FORMAT(REMIND_TIME,'%Y%m')
GROUP BY DATE_FORMAT(HAPPENED_TIME,'%Y%m')
UNION ALL
SELECT
COUNT(id) as count,
@ -40,7 +40,7 @@
<if test=' isSelf == "1" '>
AND PUBLISH_STAFF_ID = #{staffId}
</if>
AND PUBLISH_ORG_PATH LIKE CONCAT(#{path},'%')
AND (PUBLISH_PARTY_ORG_ID = #{orgId} or PUBLISH_ORG_PATH LIKE CONCAT('%',#{orgId},'%'))
GROUP BY HOLD_MONTH_ID)t
GROUP BY t.monthId
</select>
@ -48,24 +48,77 @@
SELECT
ID AS scheduleId,
TITLE,
DATE_FORMAT(REMIND_TIME,'%Y-%m-%d %H:%i:%s') AS remindTime,
DATE_FORMAT(REMIND_TIME,'%Y%m%d') AS dateId,
DATE_FORMAT(REMIND_TIME,'%Y-%m-%d') AS remindTime,
DATE_FORMAT(happened_time,'%Y-%m-%d %H:%i:%s') AS happenedTime,
DATE_FORMAT(HAPPENED_TIME,'%Y%m%d') AS dateId,
REMARK,
STAFF_ID
FROM ic_schedule
WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
<if test='null != dateId and dateId != "" '>
AND DATE_FORMAT(REMIND_TIME,'%Y%m%d') = #{dateId}
AND DATE_FORMAT(HAPPENED_TIME,'%Y%m%d') = #{dateId}
</if>
<if test='null != startDate and startDate != ""'>
AND DATE_FORMAT(REMIND_TIME,'%Y%m%d') >= #{startDate}
AND DATE_FORMAT(HAPPENED_TIME,'%Y%m%d') >= #{startDate}
</if>
<if test='null != endDate and endDate != ""'>
AND DATE_FORMAT(REMIND_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endDate}
AND DATE_FORMAT(HAPPENED_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endDate}
</if>
AND ORG_ID_PATH LIKE CONCAT('%',#{agencyId},'%')
AND (IS_PUBLIC = '1' OR (STAFF_ID = #{staffId} AND IS_PUBLIC = '0'))
order by REMIND_TIME desc
order by HAPPENED_TIME desc
</select>
<select id="selectScheduleList" resultType="com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO">
SELECT
id,
customer_id,
staff_id,
title,
remind_time,
DATE_FORMAT(remind_time,'%Y-%m-%d')remindTimeName,
DATE_FORMAT(happened_time,'%Y-%m-%d %H:%i:%s')happenedTime,
is_public,
IF (is_public = '0', '仅自己可见', '组织内其他人可见') "isPublicName",
remark,
created_time
FROM
ic_schedule
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND org_id_path LIKE CONCAT('%',#{agencyId},'%')
<if test="title != null and title.trim() != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test='null != startTime and startTime != ""'>
AND DATE_FORMAT(HAPPENED_TIME,'%Y%m%d') >= #{startTime}
</if>
<if test='null != endTime and endTime != ""'>
AND DATE_FORMAT(HAPPENED_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
</if>
<choose>
<when test='isPublic == "0"'>
AND staff_id = #{staffId} AND is_public = #{isPublic}
</when>
<when test='isPublic == "1"'>
AND is_public = #{isPublic}
</when>
<otherwise>
AND (is_public = '1' OR (staff_id = #{staffId} AND is_public = '0'))
</otherwise>
</choose>
order by HAPPENED_TIME desc
</select>
<select id="selectNeedNotice" parameterType="java.lang.String" resultType="com.epmet.modules.partyOrg.entity.IcScheduleEntity">
SELECT
i.*
FROM
ic_schedule i
WHERE
i.DEL_FLAG = '0'
AND DATE_FORMAT( i.REMIND_TIME, '%Y%m%d' ) = #{dateId}
</select>
</mapper>
Loading…
Cancel
Save