Browse Source

积分相关,党组织相关

dev
zhaoqifeng 3 years ago
parent
commit
59f63ea751
  1. 2
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java
  2. 24
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PartyPointFormDTO.java
  3. 25
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointResultDTO.java
  4. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java
  5. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java
  6. 12
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java
  7. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java
  8. 19
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java
  9. 86
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  10. 25
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml
  11. 18
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml
  12. 2
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgTreeListDTO.java
  13. 1
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java
  14. 17
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java
  15. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml

2
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java

@ -98,5 +98,5 @@ public class PointAdditiveRuleDTO implements Serializable {
* 更新时间
*/
private Date updatedTime;
private String editFlag;
}

24
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PartyPointFormDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/8/22 15:57
*/
@Data
public class PartyPointFormDTO implements Serializable {
private static final long serialVersionUID = -4811220825653023328L;
private String customerId;
private String userId;
private String year;
private String quarter;
private String month;
private String type;
private String dateType;
private String startDate;
private String endDate;
}

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

@ -0,0 +1,25 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/8/22 15:59
*/
@Data
public class PartyPointResultDTO implements Serializable {
private static final long serialVersionUID = -3208641116926725011L;
private String title;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date dateTime;
private String point;
private String actId;
private String actType;
private String actDate;
private String actAddress;
}

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java

@ -8,6 +8,7 @@ import com.epmet.dto.form.List4treeFormDTO;
import com.epmet.dto.form.SubmitRewardFormDTO;
import com.epmet.dto.result.List4ApplyResultDTO;
import com.epmet.entity.PointAdditiveRuleEntity;
import com.epmet.entity.PointRuleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -87,4 +88,6 @@ public interface PointAdditiveRuleDao extends BaseDao<PointAdditiveRuleEntity> {
* @return com.epmet.dto.PointAdditiveRuleDTO
*/
PointAdditiveRuleDTO selectRuledetail(@Param("ruleId") String ruleId);
PointRuleEntity selectByRoleName(@Param("customerId") String customerId, @Param("roleName") String roleName);
}

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java

@ -19,7 +19,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.IcResiPointPageFormDTO;
import com.epmet.dto.form.PartyPointFormDTO;
import com.epmet.dto.result.MyPointTaskResultDTO;
import com.epmet.dto.result.PartyPointResultDTO;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.dto.result.ResiPointPageResDTO;
import com.epmet.entity.UserPointActionLogEntity;
@ -73,4 +75,6 @@ public interface UserPointActionLogDao extends BaseDao<UserPointActionLogEntity>
@Param("dateId")String dateId);
List<ResiPointPageResDTO> selectPageResiPoin(IcResiPointPageFormDTO formDTO);
List<PartyPointResultDTO> getPagePartyPoint(PartyPointFormDTO formDTO);
}

12
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java

@ -24,7 +24,9 @@ import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.form.IcResiPointPageFormDTO;
import com.epmet.dto.form.MyPointTaskFormDTO;
import com.epmet.dto.form.PartyPointFormDTO;
import com.epmet.dto.result.MyPointTaskResultDTO;
import com.epmet.dto.result.PartyPointResultDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointPageResDTO;
import com.epmet.entity.UserPointActionLogEntity;
@ -159,4 +161,14 @@ public interface UserPointActionLogService extends BaseService<UserPointActionLo
* @return
*/
PageData<ResiPointPageResDTO> pageUserPoint(IcResiPointPageFormDTO formDTO);
/**
* 党建积分
*
* @Param formDTO
* @Return {@link PageData< PartyPointResultDTO>}
* @Author zhaoqifeng
* @Date 2022/8/22 16:04
*/
PageData<PartyPointResultDTO> pagePartyPoint(PartyPointFormDTO formDTO);
}

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -127,11 +128,10 @@ public class BizPointUserTotalDetailServiceImpl extends BaseServiceImpl<BizPoint
*/
@Override
public BizPointUserTotalDetailDTO getDataByObject(String type, String objectId, String userId) {
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("DEL_FLAG", NumConstant.ZERO_STR);
LambdaQueryWrapper<BizPointUserTotalDetailEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BizPointUserTotalDetailEntity::getBizType, type)
.eq(StringUtils.isNotBlank(objectId), BizPointUserTotalDetailEntity::getObjectId, objectId)
.eq(BizPointUserTotalDetailEntity::getUserId, userId);
BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class);
}

19
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.common.enu.PointAddRuleEnum;
@ -27,7 +28,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 附加积分规则
@ -200,7 +203,21 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl<PointAdditiveR
@Override
public Result<List<PointAdditiveRuleDTO>> list4tree(List4treeFormDTO dto) {
LambdaQueryWrapper<PointAdditiveRuleEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PointAdditiveRuleEntity::getCustomerId, dto.getCustomerId());
wrapper.eq(PointAdditiveRuleEntity::getCategoryName, "党建活动");
PointAdditiveRuleEntity rule = baseDao.selectOne(wrapper);
List<PointAdditiveRuleDTO> result = baseDao.selectList4tree(dto);
if (CollectionUtils.isNotEmpty(result)) {
result.forEach(item -> {
if (item.getId().equals(rule.getId()) || item.getPid().equals(rule.getId())) {
item.setEditFlag(NumConstant.ONE_STR);
} else {
item.setEditFlag(NumConstant.ZERO_STR);
}
});
}
return new Result<List<PointAdditiveRuleDTO>>().ok(result);
}

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

@ -30,6 +30,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.PointAdditiveRuleDao;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.dto.BizPointUserTotalDetailDTO;
@ -38,10 +39,8 @@ import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.form.IcResiPointPageFormDTO;
import com.epmet.dto.form.MyPointTaskFormDTO;
import com.epmet.dto.result.MyPointTaskResultDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.dto.result.ResiPointPageResDTO;
import com.epmet.dto.form.PartyPointFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.PointRuleEntity;
import com.epmet.entity.UserPointActionLogEntity;
import com.epmet.entity.UserPointStatisticalDailyEntity;
@ -64,6 +63,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -89,6 +89,8 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Autowired
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient;
@Resource
private PointAdditiveRuleDao pointAdditiveRuleDao;
@Override
public PageData<UserPointActionLogDTO> page(Map<String, Object> params) {
@ -207,6 +209,9 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
throw new RenException("无法识别事件类型与积分规则");
}
PointRuleEntity ruleInfo = pointRuleService.getByEventCodeAndCustomerId(event.getCustomerId(),eventCode);
if ("party_building".equals(event.getEventClass())) {
ruleInfo = pointAdditiveRuleDao.selectByRoleName(event.getCustomerId(), eventCode);
}
if(null != ruleInfo && StringUtils.equals(NumConstant.ONE_STR,ruleInfo.getEnabledFlag())){
Date dateCheck = null;
Calendar calendar = Calendar.getInstance();
@ -338,6 +343,9 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
if (("resi_group").equals(event.getEventClass())) {
action.setBizType("group");
action.setObjectId(event.getGroupId());
} else if ("party_building".equals(event.getEventClass())) {
action.setBizType("party_building");
action.setObjectId(event.getSourceId());
} else {
action.setBizType("activity");
action.setObjectId(event.getSourceId());
@ -406,6 +414,26 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
bizPointTotalDetailService.update(totalDetailDTO);
}
} else if ("party_building".equals(event.getEventClass())){
//个人小组积分
BizPointUserTotalDetailDTO userTotalDetailDTO = bizPointUserTotalDetailService.getDataByObject("party_building", null,
event.getUserId());
Integer userTotal = getUserTotalByObject("party_building", null, event.getUserId());
if (null == userTotalDetailDTO) {
userTotalDetailDTO = new BizPointUserTotalDetailDTO();
userTotalDetailDTO.setCustomerId(event.getCustomerId());
userTotalDetailDTO.setAgencyId(event.getAgencyId());
userTotalDetailDTO.setGridId(event.getGridId());
userTotalDetailDTO.setUserId(event.getUserId());
userTotalDetailDTO.setBizType("party_building");
userTotalDetailDTO.setObjectId(event.getSourceId());
userTotalDetailDTO.setTotalPoint(userTotal);
bizPointUserTotalDetailService.save(userTotalDetailDTO);
} else {
userTotalDetailDTO.setTotalPoint(userTotal);
userTotalDetailDTO.setUpdatedTime(new Date());
bizPointUserTotalDetailService.update(userTotalDetailDTO);
}
}
@ -507,7 +535,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
QueryWrapper<UserPointActionLogEntity> wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq(StringUtils.isNotBlank(objectId), "OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("ACTION_FLAG", "plus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
@ -579,6 +607,54 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
/**
* 党建积分
*
* @param formDTO
* @Param formDTO
* @Return {@link PageData< PartyPointResultDTO >}
* @Author zhaoqifeng
* @Date 2022/8/22 16:04
*/
@Override
public PageData<PartyPointResultDTO> pagePartyPoint(PartyPointFormDTO formDTO) {
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 {
formDTO.setStartDate(formDTO.getYear());
formDTO.setDateType(NumConstant.ONE_STR);
}
return null;
}
/**
* 需求完成给志愿者发放积分
* @param list

25
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml

@ -122,6 +122,31 @@
WHERE DEL_FLAG='0'
AND ID=#{ruleId}
</select>
<select id="selectByRoleName" resultType="com.epmet.entity.PointRuleEntity">
SELECT
a.ID,
a.RULE_NAME,
a.RULE_NAME AS RULE_DESC,
a.POINT_VALUE AS POINT,
"time" AS POINT_UNIT,
"1" AS ENABLED_FLAG,
- 1 AS UP_LIMIT,
"plus" AS OPERATE_TYPE,
"unlimit" AS RULE_PERIOD
FROM
point_additive_rule a
INNER JOIN point_additive_rule b ON a.PID = b.ID
AND b.DEL_FLAG = '0'
AND b.TYPE = 'category'
AND b.CATEGORY_CODE = 'party_building'
AND b.CATEGORY_NAME = '党建活动'
WHERE
a.DEL_FLAG = '0'
AND a.CATEGORY_CODE = 'party_building'
AND a.TYPE = 'rule'
AND a.CUSTOMER_ID = #{customerId}
AND a.RULE_NAME = #{roleName}
</select>
</mapper>

18
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml

@ -157,5 +157,23 @@
</if>
ORDER BY temp.sort ASC
</select>
<select id="getPagePartyPoint" resultType="com.epmet.dto.result.PartyPointResultDTO">
SELECT
OBJECT_ID AS actId,
EVENT_NAME AS title,
CASE
ACTION_FLAG
WHEN 'plus' THEN
concat( '+', POINT ) ELSE POINT
END AS point,
CREATED_TIME AS dateTime
FROM
USER_POINT_ACTION_LOG
WHERE
DEL_FLAG = '0'
AND BIZ_TYPE = 'party_building'
ORDER BY
CREATED_TIME DESC
</select>
</mapper>

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

@ -23,7 +23,7 @@ public class PartyOrgTreeListDTO implements Serializable {
* 客户Id (customer.id)
*/
private String customerId;
private String staffId;
/**
* 党组织pid
*/

1
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java

@ -114,6 +114,7 @@ public class IcPartyOrgController {
@PostMapping("getOrgTreeHaveGroup")
public Result<List<IcPartyOrgTreeDTO>> getOrgTreeHaveGroup(@LoginUser TokenDto tokenDto,PartyOrgTreeListDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
return new Result<List<IcPartyOrgTreeDTO>>().ok(icPartyOrgService.getOrgTreeHaveGroup(formDTO));
}

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

@ -204,8 +204,10 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
// baseDao.deleteBatchIds(Arrays.asList(ids));
Result<Map<String, List<IcPartyOrgTreeDTO>>> groupResult = resiGroupOpenFeignClient.getBranchGroupList();
if (!groupResult.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询支部小组错误", "查询支部小组错误");
}
for (String id : ids) {
//判断该组织是否有下级党组织
List<IcPartyOrgEntity> orgList = baseDao.selectAllByOrgId(id);
@ -217,6 +219,10 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart
if (!CollectionUtils.isEmpty(memberList)) {
throw new EpmetException("该组织下有党员信息暂时不可删除!");
}
//判断该组织下是否有支部小组
if (groupResult.getData().containsKey(id)) {
throw new EpmetException("该组织下有支部小组暂时不可删除!");
}
baseDao.deleteById(id);
}
}
@ -276,6 +282,13 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart
@Override
public List<IcPartyOrgTreeDTO> getOrgTreeHaveGroup(PartyOrgTreeListDTO formDTO) {
if (StringUtils.isBlank(formDTO.getAgencyId())) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null == staffInfo) {
throw new EpmetException("获取工作人员信息失败");
}
formDTO.setAgencyId(staffInfo.getAgencyId());
}
List<IcPartyOrgTreeDTO> list = baseDao.getSearchTreelist(formDTO);
Result<Map<String, List<IcPartyOrgTreeDTO>>> groupResult = resiGroupOpenFeignClient.getBranchGroupList();

2
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml

@ -110,7 +110,7 @@
where DEL_FLAG=0
and CUSTOMER_ID=#{customerId}
<if test="agencyId != null and agencyId != ''">
AND( AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' )
AND( AGENCY_ID=#{agencyId} OR AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' )
or
(PARTY_ORG_TYPE = '5' and AGENCY_ID=#{agencyId}))
</if>

Loading…
Cancel
Save