Browse Source

Merge branch 'dev' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev

dev_shibei_match
jianjun 4 years ago
parent
commit
586d7fed07
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 123
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  3. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java
  4. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java
  5. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java
  6. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  7. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java
  8. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  9. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  10. 41
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java
  11. 12
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  12. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml
  13. 16
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  14. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -157,6 +157,7 @@ public enum EpmetErrorCode {
COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR(8530, "%s社区自组织名称已存在"),
MATTER_NAME_EXISTS_APPOINTMENT_ERROR(8532, "存在重复预约事项"),
ERROR_DATE(8533, "不合理日期"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),

123
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -945,4 +945,127 @@ public class DateUtils {
return result;
}
/**
* @Description 获取工作日时间没有排除节假日
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:51 上午
*/
public static Date getWorkDay(Date startDate, int num) {
Date tomorrow = null;
int delay = 1;
while (delay <= num) {
tomorrow = getTomorrow(startDate);
if (!isWeekend(tomorrow)) {
delay++;
}
startDate = tomorrow;
}
return startDate;
}
/**
* @Description 根据开始时间计算出 当前日期后n个工作日没有排除节假日包括今天
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:20 上午
*/
public static List<String> getWorkDayList(Date startDate, int num) {
List<String> result = new ArrayList<>();
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(startDate);
rightNow.add(Calendar.DATE,-1);
startDate = rightNow.getTime();
Date tomorrow;
Integer tag = 1;
while (tag <= num){
tomorrow = getTomorrow(startDate);
// 返回工作日
if (!isWeekend(tomorrow)) {
result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow));
tag++;
}
startDate = tomorrow;
}
return result;
}
/**
* @Description 根据开始时间计算出 当前日期后n个周末没有排除节假日包括今天
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:20 上午
*/
public static List<String> getWeekendDayList(Date startDate, int num) {
List<String> result = new ArrayList<>();
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(startDate);
rightNow.add(Calendar.DATE,-1);
startDate = rightNow.getTime();
Date tomorrow;
Integer tag = 1;
while (tag <= num){
tomorrow = getTomorrow(startDate);
// 返回周末
if (isWeekend(tomorrow)) {
result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow));
tag++;
}
startDate = tomorrow;
}
return result;
}
/**
* @Description 根据开始时间计算出 当前日期后n天没有排除节假日包括今天
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:20 上午
*/
public static List<String> getEveryDayList(Date startDate, int num) {
List<String> result = new ArrayList<>();
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(startDate);
rightNow.add(Calendar.DATE,-1);
startDate = rightNow.getTime();
Date tomorrow;
Integer tag = 1;
while (tag <= num){
tomorrow = getTomorrow(startDate);
result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow));
tag++;
startDate = tomorrow;
}
return result;
}
/**
* @Description 判断日期字符串是否为周末
* @param date eg:yyyy-MM-dd
* @author zxc
* @date 2022/1/7 10:50 上午
*/
private static boolean isWeekend(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY;
}
/**
* @Description 获取tomorrow的日期
* @param startDate
* @author zxc
* @date 2022/1/7 10:50 上午
*/
private static Date getTomorrow(Date startDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(startDate);
cal.add(Calendar.DAY_OF_MONTH, +1);
return cal.getTime();
}
}

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java

@ -47,6 +47,11 @@ public class AllMattersResultDTO implements Serializable {
@JsonIgnore
private String endTime;
/**
* 预约类型每天everyDay工作日workDay周末weekend
*/
private String appointmentType;
public AllMattersResultDTO() {
this.matterName = "";
this.allowTime = "";
@ -55,5 +60,6 @@ public class AllMattersResultDTO implements Serializable {
this.address = "";
this.workPhone = "";
this.centerName = "";
this.appointmentType="";
}
}

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java

@ -27,8 +27,11 @@ public class AppointmentTimeResultDTO implements Serializable {
*/
private List<TimeDTO> timeDetail;
private List<String> dateList;
public AppointmentTimeResultDTO() {
this.appointmentType = "";
this.timeDetail = new ArrayList<>();
this.dateList = new ArrayList<>();
}
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java

@ -13,4 +13,8 @@ public interface PartyServiceCenterConstant {
String APPOINTMENT_STATUS_APPOINTING = "appointing";
String APPOINTMENT_STATUS_CANCEL = "cancel";
String APPOINTMENT_TYPE_EVERY_DAY = "everyDay";
String APPOINTMENT_TYPE_WORK_DAY = "workDay";
String APPOINTMENT_TYPE_WEEKEND = "weekend";
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -306,5 +306,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
OrgMobileResultDTO getAgencyMobile(@Param("gridId") String gridId);
int updateSubAgencyAreaCode(@Param("customerId") String customerId, @Param("originalParentAreaCode")String originalParentAreaCode,@Param("operateUserId") String operateUserId);
int updateSubAgencyAreaCodeById(@Param("customerId")String customerId, @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId);
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java

@ -101,4 +101,10 @@ public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity>
* @Date 2020/12/15 10:05
**/
int delDeptById(@Param("deptId")String deptId,@Param("operateUserId") String operateUserId);
int updateSubDeptAreaCode(@Param("customerId") String customerId,
@Param("areaCode")String areaCode,
@Param("operateUserId") String operateUserId);
int updateDeptAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode);
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -351,4 +351,10 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Description 网格组织信息
**/
CustomerGridDTO gridAgencyByGrid(@Param("gridId") String gridId);
int updateSubGridAreaCode(@Param("customerId") String customerId,
@Param("agencyId")String agencyId,
@Param("operateUserId") String operateUserId);
int updateGridAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode);
}

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -33,6 +33,7 @@ import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.constant.RoleKeyConstants;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dao.CustomerDepartmentDao;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dto.CustomerAgencyDTO;
@ -93,7 +94,8 @@ public class AgencyServiceImpl implements AgencyService {
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private IcBuildingDao icBuildingDao;
@Autowired
private CustomerDepartmentDao customerDepartmentDao;
/**
* @param formDTO
@ -153,8 +155,17 @@ public class AgencyServiceImpl implements AgencyService {
originalEntity.setContacts(formDTO.getContacts());
originalEntity.setMobile(formDTO.getMobile());
if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) {
CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid());
//如果修改了areaCode。
customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId());
if(StringUtils.isNotBlank(originalEntity.getAreaCode())){
//如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。
// customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId());
customerAgencyDao.updateSubAgencyAreaCodeById(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId());
//网格的
customerGridDao.updateSubGridAreaCode(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId());
//部门的
customerDepartmentDao.updateSubDeptAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId());
}
//判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码
if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) {
@ -166,6 +177,7 @@ public class AgencyServiceImpl implements AgencyService {
throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg());
}
originalEntity.setAreaCode(formDTO.getAreaCode());
originalEntity.setParentAreaCode(parent.getAreaCode());
}else{
//如果选择的是other,需要自定义一个编码
AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO();
@ -177,8 +189,11 @@ public class AgencyServiceImpl implements AgencyService {
throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg());
}
originalEntity.setAreaCode(addAreaCodeResult.getData());
originalEntity.setParentAreaCode(parent.getAreaCode());
}
}
customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode());
customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode());
}
//1:更新当前组织信息

41
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java

@ -275,6 +275,20 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
@Override
@Transactional(rollbackFor = Exception.class)
public void appointment(AppointmentFormDTO formDTO, TokenDto tokenDto) {
IcPartyServiceCenterMatterEntity entity = matterService.selectById(formDTO.getMatterId());
if (null == entity){
throw new EpmetException("不存在此预约事项");
}
List<String> dateList = getDateList(entity.getAppointmentType());
Boolean s = false;
for (String d : dateList) {
if (d.equals(formDTO.getAppointmentDate())){
s = true;
}
}
if (!s){
throw new EpmetException(EpmetErrorCode.ERROR_DATE.getCode());
}
String customerId = tokenDto.getCustomerId();
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>();
l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId())
@ -322,6 +336,20 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
@Override
@Transactional(rollbackFor = Exception.class)
public void appointmentMini(AppointmentMiniFormDTO formDTO, TokenDto tokenDto) {
IcPartyServiceCenterMatterEntity entity = matterService.selectById(formDTO.getMatterId());
if (null == entity){
throw new EpmetException("不存在此预约事项");
}
List<String> dateList = getDateList(entity.getAppointmentType());
Boolean s = false;
for (String d : dateList) {
if (d.equals(formDTO.getAppointmentDate())){
s = true;
}
}
if (!s){
throw new EpmetException(EpmetErrorCode.ERROR_DATE.getCode());
}
String customerId = tokenDto.getCustomerId();
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>();
l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId())
@ -423,6 +451,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
throw new RenException("事项不存在...");
}
result.setAppointmentType(matter.getAppointmentType());
result.setDateList(getDateList(result.getAppointmentType()));
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>();
l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId())
.eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getDate())
@ -487,6 +516,18 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
return result;
}
public List<String> getDateList(String type) {
List<String> result = new ArrayList<>();
if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_EVERY_DAY)){
result = DateUtils.getEveryDayList(new Date(),NumConstant.SEVEN);
}else if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_WORK_DAY)){
result = DateUtils.getWorkDayList(new Date(),NumConstant.SEVEN);
}else {
result = DateUtils.getWeekendDayList(new Date(),NumConstant.SEVEN);
}
return result;
}
/**
* @Description 党群服务中心预约记录
* @param formDTO

12
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -742,4 +742,16 @@
AND CUSTOMER_ID = #{customerId}
AND PARENT_AREA_CODE LIKE concat( #{originalParentAreaCode}, '%' )
</update>
<update id="updateSubAgencyAreaCodeById" parameterType="map">
UPDATE customer_agency
SET AREA_CODE = '',
PARENT_AREA_CODE = '',
UPDATED_BY=#{operateUserId},
UPDATED_TIME = NOW()
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND pids LIKE concat('%',#{agencyId}, '%' )
</update>
</mapper>

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml

@ -87,4 +87,21 @@
UPDATED_TIME=NOW()
where id=#{deptId}
</update>
<update id="updateSubDeptAreaCode" parameterType="map">
update customer_department
SET AREA_CODE = '',
UPDATED_BY=#{operateUserId},
UPDATED_TIME = NOW()
where customer_id=#{customerId}
AND AREA_CODE LIKE concat(#{areaCode}, '%' )
</update>
<update id="updateDeptAreaCode" parameterType="map">
update customer_department
SET AREA_CODE = #{areaCode},
UPDATED_TIME = NOW()
where del_flag='0'
and agency_id=#{agencyId}
</update>
</mapper>

16
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -755,4 +755,20 @@
AND cg.id = #{gridId}
</select>
<update id="updateSubGridAreaCode" parameterType="map">
update customer_grid
SET AREA_CODE = '',
UPDATED_BY=#{operateUserId},
UPDATED_TIME = NOW()
where customer_id=#{customerId}
AND pids LIKE concat('%',#{agencyId}, '%' )
</update>
<update id="updateGridAreaCode" parameterType="map">
update customer_grid
SET AREA_CODE = #{areaCode},
UPDATED_TIME = NOW()
where del_flag='0'
and pid=#{agencyId}
</update>
</mapper>

3
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml

@ -64,7 +64,8 @@
IFNULL(cm.MATTER_IMG,'') AS matterImg,
c.ADDRESS,
c.WORK_PHONE,
c.CENTER_NAME
c.CENTER_NAME,
cm.APPOINTMENT_TYPE as appointmentType
FROM ic_party_service_center c
INNER JOIN ic_party_service_center_matter cm ON (cm.PARTY_SERVICE_CENTER_ID = c.ID AND cm.DEL_FLAG = 0)
AND c.DEL_FLAG = 0

Loading…
Cancel
Save