18 changed files with 755 additions and 4 deletions
@ -0,0 +1,72 @@ |
|||
package com.epmet.commons.tools.enums; |
|||
|
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
|
|||
import java.util.Objects; |
|||
|
|||
/** |
|||
* @author Administrator |
|||
*/ |
|||
|
|||
public enum DateEnum { |
|||
/** |
|||
* 月份相关枚举 |
|||
*/ |
|||
JAN("01", "1月"), |
|||
FEB("02", "2月"), |
|||
MAR("03", "3月"), |
|||
APR("04", "4月"), |
|||
MAY("05", "5月"), |
|||
JUN("06", "6月"), |
|||
JUL("07", "7月"), |
|||
AUG("08", "8月"), |
|||
SEP("09", "9月"), |
|||
OCT("10", "10月"), |
|||
NOV("11", "11月"), |
|||
DEC("12", "12月"), |
|||
/** |
|||
* 季度相关枚举 |
|||
*/ |
|||
Q1("Q1", "第一季度"), |
|||
Q2("Q2", "第二季度"), |
|||
Q3("Q3", "第三季度"), |
|||
Q4("Q4", "第四季度"), |
|||
|
|||
|
|||
UN_KNOWN("0", "未知"); |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
|
|||
DateEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public static String getName(String code) { |
|||
DateEnum[] dateEnums = values(); |
|||
for (DateEnum dateEnum : dateEnums) { |
|||
if (Objects.equals(dateEnum.getCode(), code)) { |
|||
return dateEnum.getName(); |
|||
} |
|||
} |
|||
return EpmetErrorCode.SERVER_ERROR.getMsg(); |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(String code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
} |
@ -0,0 +1,115 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 联建单位完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-01-17 |
|||
*/ |
|||
@Data |
|||
public class IcPartyUnitCompletionDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 单位ID |
|||
*/ |
|||
@NotNull(message = "单位ID不能为空",groups = AddGroup.class) |
|||
private String unitId; |
|||
|
|||
/** |
|||
* 类型 monthly月度,quarter季度 |
|||
*/ |
|||
@NotNull(message = "类型不能为空",groups = AddGroup.class) |
|||
private String type; |
|||
|
|||
/** |
|||
* 评分 百分制 |
|||
*/ |
|||
@NotNull(message = "评分不能为空",groups = AddGroup.class) |
|||
private String score; |
|||
|
|||
/** |
|||
* 完成情况1已完成,0未完成 |
|||
*/ |
|||
@NotNull(message = "完成情况不能为空",groups = AddGroup.class) |
|||
private String status; |
|||
|
|||
/** |
|||
* 年份 |
|||
*/ |
|||
@NotNull(message = "年份不能为空",groups = AddGroup.class) |
|||
private String year; |
|||
|
|||
/** |
|||
* 月或季度 |
|||
*/ |
|||
@NotNull(message = "月或季度",groups = AddGroup.class) |
|||
private String monthQuarter; |
|||
|
|||
private String monthQuarterName; |
|||
|
|||
/** |
|||
* 时间 |
|||
*/ |
|||
private String recordDate; |
|||
|
|||
/** |
|||
* 删除标识 0未删除、1已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/1/17 15:46 |
|||
*/ |
|||
@Data |
|||
public class CompletionFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 4925867264241549310L; |
|||
private String unitId; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/1/18 9:34 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class PointRecordFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -5200348821951188343L; |
|||
/** |
|||
* 服务方类型:社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit |
|||
*/ |
|||
private String serviceType; |
|||
/** |
|||
* 服务方ID |
|||
*/ |
|||
private String serviceId; |
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
|||
private String startTime; |
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
|||
private String endTime; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
private String customerId; |
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/1/18 9:30 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class PointRecordDTO implements Serializable { |
|||
private static final long serialVersionUID = 8562346042241117055L; |
|||
/** |
|||
* 需求类型 |
|||
*/ |
|||
@JsonIgnore |
|||
private String categoryCode; |
|||
private String categoryName; |
|||
/** |
|||
* 需求人 |
|||
*/ |
|||
private String demandUserName; |
|||
/** |
|||
* 需求内容 |
|||
*/ |
|||
private String content; |
|||
/** |
|||
* 发放积分时间 |
|||
*/ |
|||
private String pointTime; |
|||
/** |
|||
* 评价 |
|||
*/ |
|||
private String score; |
|||
/** |
|||
* 积分 |
|||
*/ |
|||
private String point; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/1/18 9:28 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class PointRecordResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -2359756064125925616L; |
|||
private Integer totalPoint; |
|||
private PageData<PointRecordDTO> page; |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
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.dto.IcPartyUnitCompletionDTO; |
|||
import com.epmet.dto.form.CompletionFormDTO; |
|||
import com.epmet.service.IcPartyUnitCompletionService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
|
|||
/** |
|||
* 联建单位完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-01-17 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("icpartyunitcompletion") |
|||
public class IcPartyUnitCompletionController { |
|||
|
|||
@Autowired |
|||
private IcPartyUnitCompletionService icPartyUnitCompletionService; |
|||
|
|||
@PostMapping("list") |
|||
public Result<PageData<IcPartyUnitCompletionDTO>> page(@RequestParam CompletionFormDTO formDTO){ |
|||
PageData<IcPartyUnitCompletionDTO> page = icPartyUnitCompletionService.page(formDTO); |
|||
return new Result<PageData<IcPartyUnitCompletionDTO>>().ok(page); |
|||
} |
|||
|
|||
@PostMapping("save") |
|||
public Result save(@RequestBody IcPartyUnitCompletionDTO dto){ |
|||
//效验数据
|
|||
if (StringUtils.isBlank(dto.getUnitId())) { |
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
} |
|||
icPartyUnitCompletionService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody IcPartyUnitCompletionDTO dto){ |
|||
icPartyUnitCompletionService.delete(dto.getId()); |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcPartyUnitCompletionEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 联建单位完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-01-17 |
|||
*/ |
|||
@Mapper |
|||
public interface IcPartyUnitCompletionDao extends BaseDao<IcPartyUnitCompletionEntity> { |
|||
|
|||
} |
@ -0,0 +1,71 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 联建单位完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-01-17 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_party_unit_completion") |
|||
public class IcPartyUnitCompletionEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 单位ID |
|||
*/ |
|||
private String unitId; |
|||
|
|||
/** |
|||
* 类型 monthly月度,quarter季度 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 评分 百分制 |
|||
*/ |
|||
private String score; |
|||
|
|||
/** |
|||
* 完成情况1已完成,0未完成 |
|||
*/ |
|||
private String status; |
|||
|
|||
/** |
|||
* 年份 |
|||
*/ |
|||
private String year; |
|||
|
|||
/** |
|||
* 月或季度 |
|||
*/ |
|||
private String monthQuarter; |
|||
|
|||
/** |
|||
* 时间 |
|||
*/ |
|||
private String recordDate; |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcPartyUnitCompletionDTO; |
|||
import com.epmet.dto.form.CompletionFormDTO; |
|||
import com.epmet.entity.IcPartyUnitCompletionEntity; |
|||
|
|||
/** |
|||
* 联建单位完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-01-17 |
|||
*/ |
|||
public interface IcPartyUnitCompletionService extends BaseService<IcPartyUnitCompletionEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param formDTO |
|||
* @return PageData<IcPartyUnitCompletionDTO> |
|||
* @author generator |
|||
* @date 2022-01-17 |
|||
*/ |
|||
PageData<IcPartyUnitCompletionDTO> page(CompletionFormDTO formDTO); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-01-17 |
|||
*/ |
|||
void save(IcPartyUnitCompletionDTO dto); |
|||
|
|||
/** |
|||
* 删除 |
|||
* |
|||
* @param id |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-01-17 |
|||
*/ |
|||
void delete(String id); |
|||
} |
@ -0,0 +1,86 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.enums.DateEnum; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.dao.IcPartyUnitCompletionDao; |
|||
import com.epmet.dto.IcPartyUnitCompletionDTO; |
|||
import com.epmet.dto.IcPartyUnitDTO; |
|||
import com.epmet.dto.form.CompletionFormDTO; |
|||
import com.epmet.entity.IcPartyUnitCompletionEntity; |
|||
import com.epmet.service.IcPartyUnitCompletionService; |
|||
import com.epmet.service.IcPartyUnitService; |
|||
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; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 联建单位完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-01-17 |
|||
*/ |
|||
@Service |
|||
public class IcPartyUnitCompletionServiceImpl extends BaseServiceImpl<IcPartyUnitCompletionDao, IcPartyUnitCompletionEntity> implements IcPartyUnitCompletionService { |
|||
|
|||
@Resource |
|||
private IcPartyUnitService icPartyUnitService; |
|||
|
|||
@Override |
|||
public PageData<IcPartyUnitCompletionDTO> page(CompletionFormDTO formDTO) { |
|||
if (StringUtils.isBlank(formDTO.getUnitId())) { |
|||
return new PageData<>(Collections.emptyList(), NumConstant.ZERO); |
|||
} |
|||
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|||
LambdaQueryWrapper<IcPartyUnitCompletionEntity> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(IcPartyUnitCompletionEntity::getUnitId, formDTO.getUnitId()); |
|||
wrapper.orderByDesc(IcPartyUnitCompletionEntity::getCreatedTime); |
|||
List<IcPartyUnitCompletionEntity> list = baseDao.selectList(wrapper); |
|||
PageInfo<IcPartyUnitCompletionEntity> pageInfo = new PageInfo<>(list); |
|||
List<IcPartyUnitCompletionDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitCompletionDTO.class); |
|||
|
|||
if(CollectionUtils.isNotEmpty(dtoList)) { |
|||
dtoList.forEach(item -> { |
|||
item.setMonthQuarterName(DateEnum.getName(item.getMonthQuarter())); |
|||
}); |
|||
} |
|||
|
|||
return new PageData<>(dtoList, pageInfo.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcPartyUnitCompletionDTO dto) { |
|||
IcPartyUnitCompletionEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyUnitCompletionEntity.class); |
|||
if (StringUtils.isNotBlank(dto.getYear()) && StringUtils.isNotBlank(dto.getMonthQuarter())) { |
|||
entity.setRecordDate(dto.getYear().concat(dto.getMonthQuarter())); |
|||
} |
|||
if(StringUtils.isBlank(dto.getId())) { |
|||
IcPartyUnitDTO unity = icPartyUnitService.get(dto.getUnitId()); |
|||
entity.setCustomerId(unity.getCustomerId()); |
|||
entity.setAgencyId(unity.getAgencyId()); |
|||
entity.setPids(unity.getPids()); |
|||
insert(entity); |
|||
} else { |
|||
updateById(entity); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String id) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteById(id); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
CREATE TABLE `ic_party_unit_completion` |
|||
( |
|||
`ID` varchar(64) NOT NULL COMMENT '主键', |
|||
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', |
|||
`AGENCY_ID` varchar(64) NOT NULL COMMENT '组织ID', |
|||
`PIDS` varchar(255) NOT NULL, |
|||
`UNIT_ID` varchar(64) NOT NULL COMMENT '单位ID', |
|||
`TYPE` varchar(10) NOT NULL COMMENT '类型 monthly月度,quarter季度', |
|||
`SCORE` varchar(5) NOT NULL COMMENT '评分 百分制', |
|||
`STATUS` varchar(1) NOT NULL COMMENT '完成情况1已完成,0未完成', |
|||
`YEAR` varchar(4) NOT NULL COMMENT '年份', |
|||
`MONTH_QUARTER` varchar(4) NOT NULL COMMENT '月或季度', |
|||
`RECORD_DATE` varchar(12) NOT NULL COMMENT '时间', |
|||
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除', |
|||
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', |
|||
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', |
|||
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间', |
|||
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', |
|||
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', |
|||
PRIMARY KEY (`ID`) USING BTREE |
|||
) ENGINE = InnoDB |
|||
DEFAULT CHARSET = utf8mb4 COMMENT ='联建单位完成情况'; |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.IcPartyUnitCompletionDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcPartyUnitCompletionEntity" id="icPartyUnitCompletionMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="unitId" column="UNIT_ID"/> |
|||
<result property="type" column="TYPE"/> |
|||
<result property="score" column="SCORE"/> |
|||
<result property="status" column="STATUS"/> |
|||
<result property="year" column="YEAR"/> |
|||
<result property="monthQuarter" column="MONTH_QUARTER"/> |
|||
<result property="recordDate" column="RECORD_DATE"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue