Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
ba55e8b439 | 2 years ago |
36 changed files with 2500 additions and 0 deletions
@ -0,0 +1,75 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 政策匹配资源类型 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyCategoryDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 政策id |
|||
*/ |
|||
private String icPolicyId; |
|||
|
|||
/** |
|||
* 分类编码 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 分类全路径,包含CATEGORY_CODE,英文逗号隔开 |
|||
*/ |
|||
private String codePath; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,77 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import com.epmet.commons.tools.dto.form.FileCommonDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyRuleFormDTO; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 政策表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private String policyId; |
|||
|
|||
/** |
|||
* 政策创建人,所属组织id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* AGENCY_ID的全路径,含agency_id |
|||
*/ |
|||
private String orgIdPath; |
|||
/** |
|||
* 政策级别,0市级;1区级;2街道级 |
|||
*/ |
|||
private String policyLevel; |
|||
|
|||
/** |
|||
* 政策级别,0市级;1区级;2街道级 |
|||
*/ |
|||
private String policyLevelName; |
|||
|
|||
/** |
|||
* 生效起止日期 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date startDate; |
|||
|
|||
/** |
|||
* 截止日期 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date endDate; |
|||
|
|||
/** |
|||
* 政策标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 政策内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 是否过期;1:已过期;0:未过期 |
|||
*/ |
|||
private String expiredFlag; |
|||
|
|||
//以下三个详情接口返回
|
|||
private List<IcPolicyCategoryDTO> categoryList; |
|||
private List<FileCommonDTO> attachmentList; |
|||
private List<IcPolicyRuleFormDTO> ruleList; |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 政策匹配规则 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyRuleDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 政策id |
|||
*/ |
|||
private String icPolicyId; |
|||
|
|||
/** |
|||
* 规则名称 |
|||
*/ |
|||
private String ruleName; |
|||
|
|||
/** |
|||
* 排序字段 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
@JsonIgnore |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
@JsonIgnore |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
@JsonIgnore |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@JsonIgnore |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
@JsonIgnore |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@JsonIgnore |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,120 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 政策匹配规则明细 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyRuleDetailDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 政策id |
|||
*/ |
|||
private String icPolicyId; |
|||
|
|||
/** |
|||
* 规则id |
|||
*/ |
|||
private String ruleId; |
|||
|
|||
/** |
|||
* 规则描述文字,例如:基础信息性别等于女 |
|||
*/ |
|||
private String ruleDesc; |
|||
|
|||
/** |
|||
* resi:人员信息,house:房屋信息,stat:统计信息 |
|||
*/ |
|||
private String groupType; |
|||
|
|||
/** |
|||
* 与上一条的关系;and、or |
|||
*/ |
|||
private String nextLogicalRel; |
|||
|
|||
/** |
|||
* 分组id;人员信息有值; |
|||
*/ |
|||
private String itemGroupId; |
|||
|
|||
/** |
|||
* 组件id;人员信息有值; |
|||
*/ |
|||
private String itemId; |
|||
|
|||
/** |
|||
* 查询类型:等于、不等于....;来源于字典表sql_query_type |
|||
*/ |
|||
private String queryType; |
|||
|
|||
/** |
|||
* 表名;人员信息有值; |
|||
*/ |
|||
private String colTable; |
|||
|
|||
/** |
|||
* 人员信息存储组件对应的列名;房屋信息存储ic_house表的列名;统计信息应该是定义到字典表,这里存储字典key就行吧 |
|||
*/ |
|||
private String colKey; |
|||
|
|||
/** |
|||
* 参数值 |
|||
*/ |
|||
private String colVal; |
|||
|
|||
/** |
|||
* 排序字段;同一group_type升序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,101 @@ |
|||
package com.epmet.dto.form.policy; |
|||
|
|||
import com.epmet.commons.tools.dto.form.FileCommonDTO; |
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import com.epmet.dto.IcPolicyCategoryDTO; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.Valid; |
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotEmpty; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2022/7/19 13:09 |
|||
*/ |
|||
|
|||
@Data |
|||
public class IcPolicyFormDTO implements Serializable { |
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
public interface AddUserShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
public interface UpdateUserInternalGroup { |
|||
} |
|||
@NotBlank(message = "政策id不能为空",groups = UpdateUserInternalGroup.class) |
|||
private String policyId; |
|||
/** |
|||
* 政策创建人,所属组织id |
|||
*/ |
|||
@NotBlank(message = "orgId不能为空",groups = UpdateUserInternalGroup.class) |
|||
private String orgId; |
|||
|
|||
// /**
|
|||
// * AGENCY_ID的全路径,含agency_id
|
|||
// */
|
|||
// @NotBlank(message = "orgIdPath不能为空",groups = UpdateUserInternalGroup.class)
|
|||
// private String orgIdPath;
|
|||
|
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
@NotBlank(message = "客户id不能为空", groups = AddUserInternalGroup.class) |
|||
private String customerId; |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 政策级别,0市级;1区级;2街道级 |
|||
*/ |
|||
@NotBlank(message = "政策级别不能为空", groups = AddUserShowGroup.class) |
|||
private String policyLevel; |
|||
|
|||
/** |
|||
* 生效起止日期 |
|||
*/ |
|||
@JsonFormat(pattern="yyyy-MM-dd") |
|||
@NotNull(message = "政策开始日期不能为空", groups = AddUserShowGroup.class) |
|||
private Date startDate; |
|||
|
|||
/** |
|||
* 截止日期 |
|||
*/ |
|||
@JsonFormat(pattern="yyyy-MM-dd") |
|||
@NotNull(message = "政策截止日期不能为空", groups = AddUserShowGroup.class) |
|||
private Date endDate; |
|||
|
|||
/** |
|||
* 政策标题 |
|||
*/ |
|||
@NotBlank(message = "政策标题不能为空", groups = AddUserShowGroup.class) |
|||
@Length(max = 100, groups = AddUserShowGroup.class, message = "政策标题最多输入100字") |
|||
private String title; |
|||
|
|||
/** |
|||
* 政策内容 |
|||
*/ |
|||
// @NotBlank(message = "政策内容不能为空", groups = AddUserShowGroup.class)
|
|||
@Length(max = 2000, groups = AddUserShowGroup.class, message = "政策内容最多输入2000字") |
|||
private String content; |
|||
|
|||
private List<IcPolicyCategoryDTO> categoryList; |
|||
|
|||
// @Valid
|
|||
private List<FileCommonDTO> attachmentList; |
|||
|
|||
@Valid |
|||
@NotEmpty(message = "政策细则不能为空",groups =AddUserShowGroup.class ) |
|||
private List<IcPolicyRuleFormDTO> ruleList; |
|||
|
|||
private String agencyId; |
|||
} |
|||
|
@ -0,0 +1,38 @@ |
|||
package com.epmet.dto.form.policy; |
|||
|
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2022/7/19 15:36 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyPageFormDTO extends PageFormDTO implements Serializable { |
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 政策标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 政策内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 是否过期;1:已过期;0:未过期 |
|||
*/ |
|||
private String expiredFlag; |
|||
private String agencyId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,94 @@ |
|||
package com.epmet.dto.form.policy; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2022/7/19 13:32 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyRuleDetailDTO { |
|||
public interface ResiRulerShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
public interface HouseRulerShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
public interface StatRulerShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
/** |
|||
* 规则描述文字,例如:基础信息性别等于女 |
|||
*/ |
|||
private String ruleDesc; |
|||
|
|||
/** |
|||
* 与下一条的关系;and、or |
|||
* 如果没有条件的话,此列为空 |
|||
*/ |
|||
private String nextLogicalRel; |
|||
|
|||
/** |
|||
* 分组id;人员信息有值; |
|||
*/ |
|||
@NotBlank(message = "itemGroupId不能为空", groups = ResiRulerShowGroup.class) |
|||
private String itemGroupId; |
|||
|
|||
/** |
|||
* 表名;人员信息有值;房屋信息也有值 |
|||
*/ |
|||
@NotBlank(message = "itemId不能为空", groups = ResiRulerShowGroup.class) |
|||
private String itemId; |
|||
|
|||
/** |
|||
* 查询类型:等于、不等于....;来源于字典表sql_query_type |
|||
*/ |
|||
@NotBlank(message = "查询类型不能为空", groups = {ResiRulerShowGroup.class,HouseRulerShowGroup.class,StatRulerShowGroup.class}) |
|||
private String queryType; |
|||
|
|||
/** |
|||
* 表名;人员信息有值; |
|||
*/ |
|||
@NotBlank(message = "colTable不能为空", groups = {ResiRulerShowGroup.class,HouseRulerShowGroup.class}) |
|||
private String colTable; |
|||
|
|||
/** |
|||
* 人员信息存储组件对应的列名;房屋信息存储ic_house表的列名;统计信息应该是定义到字典表,这里存储字典key就行吧 |
|||
*/ |
|||
@NotBlank(message = "条件不能为空", groups = {ResiRulerShowGroup.class,HouseRulerShowGroup.class,StatRulerShowGroup.class}) |
|||
private String colKey; |
|||
|
|||
/** |
|||
* 参数值 |
|||
*/ |
|||
// @NotBlank(message = "参数值不能为空", groups = {ResiRulerShowGroup.class,HouseRulerShowGroup.class,StatRulerShowGroup.class})
|
|||
private String colVal; |
|||
|
|||
/** |
|||
* 用于前端展示:基础信息、教育信息、房屋类型..... |
|||
*/ |
|||
private String itemGroupName; |
|||
/** |
|||
* 用于前端展示:姓名、手机号、...... |
|||
*/ |
|||
private String itemLabel; |
|||
|
|||
/** |
|||
* 用于前端展示:等于、不等于、大于、小于.... |
|||
*/ |
|||
private String queryTypeName; |
|||
|
|||
/** |
|||
* 用于前端展示:参数值显示值eg:男女 |
|||
*/ |
|||
private String colValLabel; |
|||
|
|||
/** |
|||
* 用于前端展示:逻辑:并且、或者 |
|||
*/ |
|||
private String nextLogicalRelName; |
|||
} |
|||
|
@ -0,0 +1,45 @@ |
|||
package com.epmet.dto.form.policy; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.Valid; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2022/7/19 13:31 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyRuleFormDTO implements Serializable { |
|||
|
|||
/** |
|||
* 细则名称 |
|||
*/ |
|||
@NotBlank(message = "细则名称不能为空", groups = IcPolicyFormDTO.AddUserShowGroup.class) |
|||
private String ruleName; |
|||
/** |
|||
* 人员信息 |
|||
*/ |
|||
@Valid |
|||
// @NotEmpty
|
|||
private List<IcPolicyRuleDetailDTO> resiRuleList; |
|||
/** |
|||
* 房屋信息 |
|||
*/ |
|||
@Valid |
|||
private List<IcPolicyRuleDetailDTO> houseRuleList; |
|||
/** |
|||
* 统计信息 |
|||
*/ |
|||
@Valid |
|||
private List<IcPolicyRuleDetailDTO> statRuleList; |
|||
|
|||
/** |
|||
* ruleId |
|||
*/ |
|||
private String id; |
|||
} |
|||
|
@ -0,0 +1,73 @@ |
|||
package com.epmet.dto.form.resi; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ResisByPolicyRulesFormDTO { |
|||
private String ruleId; |
|||
private String orgId; |
|||
private String orgType; |
|||
private String neighborHoodId; |
|||
private String buildingId; |
|||
private String unitId; |
|||
private String houseId; |
|||
private String name; |
|||
private String mobile; |
|||
private String idCard; |
|||
private RuleList ruleList = new RuleList(); |
|||
private Integer pageNo; |
|||
private Integer pageSize; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public static class RuleList { |
|||
private List<ResiRule> resiRuleList; |
|||
private List<HouseRule> houseRuleList; |
|||
private List<StatRule> statRuleList; |
|||
} |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public static class ResiRule { |
|||
private String ruleDesc; |
|||
private String nextLogicalRel; |
|||
private String itemGroupId; |
|||
private String itemId; |
|||
private String queryType; |
|||
private String colTable; |
|||
private String colKey; |
|||
private String colVal; |
|||
} |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public static class HouseRule { |
|||
private String colTable; |
|||
private String colKey; |
|||
private String colVal; |
|||
private String ruleDesc; |
|||
private String nextLogicalRel; |
|||
private String queryType; |
|||
} |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public static class StatRule { |
|||
private String colKey; |
|||
private String colVal; |
|||
private String nextLogicalRel; |
|||
private String ruleDesc; |
|||
private String queryType; |
|||
private String colTable; |
|||
} |
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.epmet.dto.result.policy; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-19 |
|||
*/ |
|||
@Data |
|||
public class IcPolicyItemResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* house:房屋信息,stat:统计信息 |
|||
*/ |
|||
private String groupType; |
|||
|
|||
/** |
|||
* 选项名;例如:房屋类型,房屋状态,人均收入 |
|||
*/ |
|||
private String label; |
|||
|
|||
/** |
|||
* 表名 |
|||
*/ |
|||
private String tableName; |
|||
|
|||
/** |
|||
* 房屋信息存储列名;统计信息定义好key放在这里 |
|||
*/ |
|||
private String colKey; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String itemType; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 值来源;需要接口获取:remote。 |
|||
*/ |
|||
private String optionSourceType; |
|||
|
|||
/** |
|||
* 动态url; |
|||
*/ |
|||
private String optionSourceUrl; |
|||
|
|||
/** |
|||
* 动态url的入参;存储json串 |
|||
*/ |
|||
private String optionSourceParam; |
|||
|
|||
} |
@ -0,0 +1,189 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.IcPolicyDTO; |
|||
import com.epmet.dto.IcPolicyRuleDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyFormDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyPageFormDTO; |
|||
import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO; |
|||
import com.epmet.dto.result.policy.IcPolicyItemResultDTO; |
|||
import com.epmet.entity.IcPolicyRuleDetailEntity; |
|||
import com.epmet.service.IcPolicyService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
|
|||
/** |
|||
* 政策表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("policy") |
|||
public class IcPolicyController { |
|||
|
|||
@Autowired |
|||
private IcPolicyService icPolicyService; |
|||
|
|||
/** |
|||
* 房屋信息、统计信息查询有哪些可选项 |
|||
* |
|||
* @param customerId |
|||
* @param groupType |
|||
* @return |
|||
*/ |
|||
@PostMapping("item-list/{groupType}") |
|||
public Result<List<IcPolicyItemResultDTO>> itemList(@RequestHeader("customerId") String customerId, @PathVariable("groupType") String groupType) { |
|||
List<IcPolicyItemResultDTO> list = icPolicyService.itemList(customerId, groupType); |
|||
return new Result<List<IcPolicyItemResultDTO>>().ok(list); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 政策管理-新增/修改 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("add") |
|||
public Result add(@LoginUser TokenDto tokenDto, @RequestBody IcPolicyFormDTO formDTO) { |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
ValidatorUtils.validateEntity(formDTO, IcPolicyFormDTO.AddUserShowGroup.class, IcPolicyFormDTO.AddUserInternalGroup.class); |
|||
icPolicyService.addOrUpdatePolicy(formDTO); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 编辑政策 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("update") |
|||
public Result update(@LoginUser TokenDto tokenDto, @RequestBody IcPolicyFormDTO formDTO) { |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
ValidatorUtils.validateEntity(formDTO, IcPolicyFormDTO.AddUserShowGroup.class, IcPolicyFormDTO.AddUserInternalGroup.class, IcPolicyFormDTO.UpdateUserInternalGroup.class); |
|||
icPolicyService.addOrUpdatePolicy(formDTO); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 政策列表 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("list") |
|||
public Result<PageData<IcPolicyDTO>> policyList(@LoginUser TokenDto tokenDto, @RequestBody IcPolicyPageFormDTO formDTO) { |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class, PageFormDTO.AddUserShowGroup.class); |
|||
PageData<IcPolicyDTO> page = icPolicyService.policyList(formDTO); |
|||
return new Result<PageData<IcPolicyDTO>>().ok(page); |
|||
} |
|||
|
|||
/** |
|||
* Desc: 政策列表下拉选 |
|||
* |
|||
* @param tokenDto |
|||
* @author zxc |
|||
* @date 2022/7/21 09:48 |
|||
*/ |
|||
@PostMapping("policyListSelect") |
|||
public Result<List<IcPolicyDTO>> policyListSelect(@LoginUser TokenDto tokenDto) { |
|||
return new Result<List<IcPolicyDTO>>().ok(icPolicyService.policyListSelect(tokenDto.getUserId(), tokenDto.getCustomerId())); |
|||
} |
|||
|
|||
/** |
|||
* 细则列表 |
|||
* |
|||
* @param customerId |
|||
* @param policyId |
|||
* @return |
|||
*/ |
|||
@PostMapping("rulelist/{policyId}") |
|||
public Result<List<IcPolicyRuleDTO>> ruleList(@RequestHeader("customerId") String customerId, @PathVariable("policyId") String policyId) { |
|||
return new Result<List<IcPolicyRuleDTO>>().ok(icPolicyService.ruleList(customerId, policyId)); |
|||
} |
|||
|
|||
/** |
|||
* 删除政策 |
|||
* |
|||
* @param policyId |
|||
* @return |
|||
*/ |
|||
@PostMapping("delete/{policyId}") |
|||
public Result deletePolicy(@PathVariable("policyId") String policyId) { |
|||
icPolicyService.deleteById(policyId); |
|||
return new Result<>(); |
|||
} |
|||
|
|||
@PostMapping("detail/{policyId}") |
|||
public Result<IcPolicyDTO> policyDetail(@LoginUser TokenDto tokenDto, @PathVariable("policyId") String policyId) { |
|||
return new Result<IcPolicyDTO>().ok(icPolicyService.policyDetail(tokenDto.getCustomerId(), policyId)); |
|||
} |
|||
|
|||
/** |
|||
* 为预览和导出提供规则列表查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping("rules4ResiListAndExport/{ruleId}") |
|||
public Result<ResisByPolicyRulesFormDTO.RuleList> listPolicyRules4QueryAndExport(@PathVariable("ruleId") String ruleId) { |
|||
Map<String, List<IcPolicyRuleDetailEntity>> ruleMap = icPolicyService.listPolicyRules4QueryAndExport(EpmetRequestHolder.getLoginUserCustomerId(), ruleId); |
|||
ResisByPolicyRulesFormDTO.RuleList data = new ResisByPolicyRulesFormDTO.RuleList(); |
|||
// resi规则
|
|||
List<IcPolicyRuleDetailEntity> originResiRules = ruleMap.get("resi"); |
|||
if (CollectionUtils.isNotEmpty(originResiRules)) { |
|||
List<ResisByPolicyRulesFormDTO.ResiRule> resiRules = originResiRules |
|||
.stream() |
|||
.map((r) -> new ResisByPolicyRulesFormDTO.ResiRule(r.getRuleDesc(), r.getNextLogicalRel(), r.getItemGroupId(), |
|||
r.getItemId(), r.getQueryType(), r.getColTable(), r.getColKey(), r.getColVal())) |
|||
.collect(Collectors.toList()); |
|||
|
|||
data.setResiRuleList(resiRules); |
|||
} |
|||
|
|||
// house规则
|
|||
List<IcPolicyRuleDetailEntity> originHouseRules = ruleMap.get("house"); |
|||
if (CollectionUtils.isNotEmpty(originHouseRules)) { |
|||
List<ResisByPolicyRulesFormDTO.HouseRule> houseRules = originHouseRules |
|||
.stream() |
|||
.map((r) -> new ResisByPolicyRulesFormDTO.HouseRule(r.getColTable(), r.getColKey(), r.getColVal(), |
|||
r.getRuleDesc(), r.getNextLogicalRel(), r.getQueryType())) |
|||
.collect(Collectors.toList()); |
|||
data.setHouseRuleList(houseRules); |
|||
} |
|||
|
|||
// stat规则
|
|||
List<IcPolicyRuleDetailEntity> originStatRules = ruleMap.get("stat"); |
|||
if (CollectionUtils.isNotEmpty(originStatRules)) { |
|||
List<ResisByPolicyRulesFormDTO.StatRule> statRules = originStatRules |
|||
.stream() |
|||
.map((r) -> new ResisByPolicyRulesFormDTO.StatRule(r.getColKey(), r.getColVal(), r.getNextLogicalRel(), |
|||
r.getRuleDesc(), r.getQueryType(), r.getColTable())) |
|||
.collect(Collectors.toList()); |
|||
|
|||
data.setStatRuleList(statRules); |
|||
} |
|||
|
|||
return new Result<ResisByPolicyRulesFormDTO.RuleList>().ok(data); |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.HeartAttachmentEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* heart库附件表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Mapper |
|||
public interface HeartAttachmentDao extends BaseDao<HeartAttachmentEntity> { |
|||
|
|||
int deleteByBusinessId(String businessId); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcPolicyCategoryEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 政策匹配资源类型 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Mapper |
|||
public interface IcPolicyCategoryDao extends BaseDao<IcPolicyCategoryEntity> { |
|||
|
|||
int deleteByIcPolicyId(String icPolicyId); |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.IcPolicyDTO; |
|||
import com.epmet.dto.result.policy.IcPolicyItemResultDTO; |
|||
import com.epmet.entity.IcPolicyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 政策表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Mapper |
|||
public interface IcPolicyDao extends BaseDao<IcPolicyEntity> { |
|||
|
|||
/** |
|||
* 房屋信息、统计信息查询有哪些可选项 |
|||
* @param customerId |
|||
* @param groupType |
|||
* @return |
|||
*/ |
|||
List<IcPolicyItemResultDTO> selectItemList(@Param("customerId") String customerId, @Param("groupType") String groupType); |
|||
|
|||
List<IcPolicyDTO> policyList(@Param("customerId") String customerId, |
|||
@Param("agencyId") String agencyId, |
|||
@Param("title") String title, |
|||
@Param("content") String content, |
|||
@Param("expiredFlag") String expiredFlag); |
|||
|
|||
String selectTitle(String policyId); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcPolicyRuleEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 政策匹配规则 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Mapper |
|||
public interface IcPolicyRuleDao extends BaseDao<IcPolicyRuleEntity> { |
|||
|
|||
int deleteByIcPolicyId(String policyId); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcPolicyRuleDetailEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 政策匹配规则明细 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Mapper |
|||
public interface IcPolicyRuleDetailDao extends BaseDao<IcPolicyRuleDetailEntity> { |
|||
|
|||
int deleteByRuleId(String ruleId); |
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* heart库附件表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("heart_attachment") |
|||
public class HeartAttachmentEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 业务id |
|||
*/ |
|||
private String businessId; |
|||
|
|||
/** |
|||
* 政策:ic_policy;服务:ic_service_record_v2 |
|||
*/ |
|||
private String attachTo; |
|||
|
|||
/** |
|||
* 附件名 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) |
|||
*/ |
|||
private String format; |
|||
|
|||
/** |
|||
* 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 附件地址 |
|||
*/ |
|||
private String url; |
|||
|
|||
/** |
|||
* 排序字段 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 附件状态(审核中:auditing; |
|||
* auto_passed: 自动通过; |
|||
* review:结果不确定,需要人工审核; |
|||
* block: 结果违规; |
|||
* rejected:人工审核驳回; |
|||
* approved:人工审核通过) |
|||
* 现在图片是同步审核的,所以图片只有auto_passed一种状态 |
|||
*/ |
|||
private String status; |
|||
|
|||
/** |
|||
* 失败原因 |
|||
*/ |
|||
private String reason; |
|||
|
|||
/** |
|||
* 语音或视频时长,秒 |
|||
*/ |
|||
private Integer duration; |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
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-07-18 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("ic_policy_category") |
|||
public class IcPolicyCategoryEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 政策id |
|||
*/ |
|||
private String icPolicyId; |
|||
|
|||
/** |
|||
* 分类编码 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 分类全路径,包含CATEGORY_CODE,英文逗号隔开 |
|||
*/ |
|||
private String codePath; |
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 政策表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_policy") |
|||
public class IcPolicyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 政策创建人,所属组织id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* AGENCY_ID的全路径,含agency_id |
|||
*/ |
|||
private String orgIdPath; |
|||
|
|||
/** |
|||
* 政策级别,0市级;1区级;2街道级 |
|||
*/ |
|||
private String policyLevel; |
|||
|
|||
/** |
|||
* 生效起止日期 |
|||
*/ |
|||
private Date startDate; |
|||
|
|||
/** |
|||
* 截止日期 |
|||
*/ |
|||
private Date endDate; |
|||
|
|||
/** |
|||
* 政策标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 政策内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
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-07-18 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_policy_rule_detail") |
|||
public class IcPolicyRuleDetailEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 政策id |
|||
*/ |
|||
private String icPolicyId; |
|||
|
|||
/** |
|||
* 规则id |
|||
*/ |
|||
private String ruleId; |
|||
|
|||
/** |
|||
* 规则描述文字,例如:基础信息性别等于女 |
|||
*/ |
|||
private String ruleDesc; |
|||
|
|||
/** |
|||
* resi:人员信息,house:房屋信息,stat:统计信息 |
|||
*/ |
|||
private String groupType; |
|||
|
|||
/** |
|||
* 与下一条的关系;and、or |
|||
* 如果没有条件的话,此列为空 |
|||
*/ |
|||
private String nextLogicalRel; |
|||
|
|||
/** |
|||
* 分组id;人员信息有值; |
|||
*/ |
|||
private String itemGroupId; |
|||
|
|||
/** |
|||
* 组件id;人员信息有值; |
|||
*/ |
|||
private String itemId; |
|||
|
|||
/** |
|||
* 查询类型:等于、不等于....;来源于字典表sql_query_type |
|||
*/ |
|||
private String queryType; |
|||
|
|||
/** |
|||
* 表名;人员信息有值;房屋信息也有值 |
|||
*/ |
|||
private String colTable; |
|||
|
|||
/** |
|||
* 人员信息存储组件对应的列名;房屋信息存储ic_house表的列名;统计信息应该是定义到字典表,这里存储字典key就行吧 |
|||
*/ |
|||
private String colKey; |
|||
|
|||
/** |
|||
* 参数值 |
|||
*/ |
|||
private String colVal; |
|||
|
|||
/** |
|||
* 排序字段;同一group_type升序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 用于前端展示:基础信息、教育信息、房屋类型..... |
|||
*/ |
|||
private String itemGroupName; |
|||
/** |
|||
* 用于前端展示:姓名、手机号、...... |
|||
*/ |
|||
private String itemLabel; |
|||
|
|||
/** |
|||
* 用于前端展示:等于、不等于、大于、小于.... |
|||
*/ |
|||
private String queryTypeName; |
|||
|
|||
/** |
|||
* 用于前端展示:参数值显示值eg:男女 |
|||
*/ |
|||
private String colValLabel; |
|||
|
|||
/** |
|||
* 用于前端展示:逻辑:并且、或者 |
|||
*/ |
|||
private String nextLogicalRelName; |
|||
} |
@ -0,0 +1,41 @@ |
|||
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-07-18 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_policy_rule") |
|||
public class IcPolicyRuleEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 政策id |
|||
*/ |
|||
private String icPolicyId; |
|||
|
|||
/** |
|||
* 规则名称 |
|||
*/ |
|||
private String ruleName; |
|||
|
|||
/** |
|||
* 排序字段 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcPolicyCategoryDTO; |
|||
import com.epmet.entity.IcPolicyCategoryEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 政策匹配资源类型 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
public interface IcPolicyCategoryService extends BaseService<IcPolicyCategoryEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<IcPolicyCategoryDTO> |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
PageData<IcPolicyCategoryDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<IcPolicyCategoryDTO> |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
List<IcPolicyCategoryDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcPolicyCategoryDTO |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
IcPolicyCategoryDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void save(IcPolicyCategoryDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void update(IcPolicyCategoryDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.form.policy.IcPolicyRuleDetailDTO; |
|||
import com.epmet.entity.IcPolicyRuleDetailEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 政策匹配规则明细 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
public interface IcPolicyRuleDetailService extends BaseService<IcPolicyRuleDetailEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<IcPolicyRuleDetailDTO> |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
PageData<IcPolicyRuleDetailDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<IcPolicyRuleDetailDTO> |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
List<IcPolicyRuleDetailDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcPolicyRuleDetailDTO |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
IcPolicyRuleDetailDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void save(IcPolicyRuleDetailDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void update(IcPolicyRuleDetailDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcPolicyRuleDTO; |
|||
import com.epmet.entity.IcPolicyRuleEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 政策匹配规则 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
public interface IcPolicyRuleService extends BaseService<IcPolicyRuleEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<IcPolicyRuleDTO> |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
PageData<IcPolicyRuleDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<IcPolicyRuleDTO> |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
List<IcPolicyRuleDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcPolicyRuleDTO |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
IcPolicyRuleDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void save(IcPolicyRuleDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void update(IcPolicyRuleDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-07-18 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcPolicyDTO; |
|||
import com.epmet.dto.IcPolicyRuleDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyFormDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyPageFormDTO; |
|||
import com.epmet.dto.result.policy.IcPolicyItemResultDTO; |
|||
import com.epmet.entity.IcPolicyEntity; |
|||
import com.epmet.entity.IcPolicyRuleDetailEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 政策表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
public interface IcPolicyService extends BaseService<IcPolicyEntity> { |
|||
/** |
|||
* 房屋信息、统计信息查询有哪些可选项 |
|||
* |
|||
* @param customerId |
|||
* @param groupType |
|||
* @return |
|||
*/ |
|||
List<IcPolicyItemResultDTO> itemList(String customerId, String groupType); |
|||
|
|||
/** |
|||
* 政策管理-新增/修改 |
|||
* |
|||
* @param formDTO |
|||
*/ |
|||
void addOrUpdatePolicy(IcPolicyFormDTO formDTO); |
|||
|
|||
/** |
|||
* 列表查询 |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
PageData<IcPolicyDTO> policyList(IcPolicyPageFormDTO formDTO); |
|||
|
|||
/** |
|||
* Desc: 政策列表下拉选 |
|||
* @author zxc |
|||
* @date 2022/7/21 09:48 |
|||
*/ |
|||
List<IcPolicyDTO> policyListSelect(String userId, String customerId); |
|||
|
|||
List<IcPolicyRuleDTO> ruleList(String customerId, String policyId); |
|||
|
|||
IcPolicyDTO policyDetail(String customerId, String policyId); |
|||
|
|||
/** |
|||
* 政策规则查询 |
|||
* @param customerId |
|||
* @param ruleId |
|||
* @return |
|||
*/ |
|||
Map<String, List<IcPolicyRuleDetailEntity>> listPolicyRules4QueryAndExport(String customerId, String ruleId); |
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.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.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.dao.IcPolicyCategoryDao; |
|||
import com.epmet.dto.IcPolicyCategoryDTO; |
|||
import com.epmet.entity.IcPolicyCategoryEntity; |
|||
import com.epmet.service.IcPolicyCategoryService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 政策匹配资源类型 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Service |
|||
public class IcPolicyCategoryServiceImpl extends BaseServiceImpl<IcPolicyCategoryDao, IcPolicyCategoryEntity> implements IcPolicyCategoryService { |
|||
|
|||
@Override |
|||
public PageData<IcPolicyCategoryDTO> page(Map<String, Object> params) { |
|||
IPage<IcPolicyCategoryEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, IcPolicyCategoryDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcPolicyCategoryDTO> list(Map<String, Object> params) { |
|||
List<IcPolicyCategoryEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, IcPolicyCategoryDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<IcPolicyCategoryEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<IcPolicyCategoryEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public IcPolicyCategoryDTO get(String id) { |
|||
IcPolicyCategoryEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, IcPolicyCategoryDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcPolicyCategoryDTO dto) { |
|||
IcPolicyCategoryEntity entity = ConvertUtils.sourceToTarget(dto, IcPolicyCategoryEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(IcPolicyCategoryDTO dto) { |
|||
IcPolicyCategoryEntity entity = ConvertUtils.sourceToTarget(dto, IcPolicyCategoryEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,81 @@ |
|||
package com.epmet.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.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.dao.IcPolicyRuleDetailDao; |
|||
import com.epmet.dto.form.policy.IcPolicyRuleDetailDTO; |
|||
import com.epmet.entity.IcPolicyRuleDetailEntity; |
|||
import com.epmet.service.IcPolicyRuleDetailService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 政策匹配规则明细 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Service |
|||
public class IcPolicyRuleDetailServiceImpl extends BaseServiceImpl<IcPolicyRuleDetailDao, IcPolicyRuleDetailEntity> implements IcPolicyRuleDetailService { |
|||
@Override |
|||
public PageData<IcPolicyRuleDetailDTO> page(Map<String, Object> params) { |
|||
IPage<IcPolicyRuleDetailEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, IcPolicyRuleDetailDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcPolicyRuleDetailDTO> list(Map<String, Object> params) { |
|||
List<IcPolicyRuleDetailEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, IcPolicyRuleDetailDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<IcPolicyRuleDetailEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<IcPolicyRuleDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public IcPolicyRuleDetailDTO get(String id) { |
|||
IcPolicyRuleDetailEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, IcPolicyRuleDetailDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcPolicyRuleDetailDTO dto) { |
|||
IcPolicyRuleDetailEntity entity = ConvertUtils.sourceToTarget(dto, IcPolicyRuleDetailEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(IcPolicyRuleDetailDTO dto) { |
|||
IcPolicyRuleDetailEntity entity = ConvertUtils.sourceToTarget(dto, IcPolicyRuleDetailEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.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.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.dao.IcPolicyRuleDao; |
|||
import com.epmet.dto.IcPolicyRuleDTO; |
|||
import com.epmet.entity.IcPolicyRuleEntity; |
|||
import com.epmet.service.IcPolicyRuleService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 政策匹配规则 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Service |
|||
public class IcPolicyRuleServiceImpl extends BaseServiceImpl<IcPolicyRuleDao, IcPolicyRuleEntity> implements IcPolicyRuleService { |
|||
|
|||
@Override |
|||
public PageData<IcPolicyRuleDTO> page(Map<String, Object> params) { |
|||
IPage<IcPolicyRuleEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, IcPolicyRuleDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcPolicyRuleDTO> list(Map<String, Object> params) { |
|||
List<IcPolicyRuleEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, IcPolicyRuleDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<IcPolicyRuleEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<IcPolicyRuleEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public IcPolicyRuleDTO get(String id) { |
|||
IcPolicyRuleEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, IcPolicyRuleDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcPolicyRuleDTO dto) { |
|||
IcPolicyRuleEntity entity = ConvertUtils.sourceToTarget(dto, IcPolicyRuleEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(IcPolicyRuleDTO dto) { |
|||
IcPolicyRuleEntity entity = ConvertUtils.sourceToTarget(dto, IcPolicyRuleEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,340 @@ |
|||
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.Constant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.dto.form.FileCommonDTO; |
|||
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|||
import com.epmet.commons.tools.enums.DictTypeEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.feign.ResultDataResolver; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|||
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.*; |
|||
import com.epmet.dto.IcPolicyCategoryDTO; |
|||
import com.epmet.dto.IcPolicyDTO; |
|||
import com.epmet.dto.IcPolicyRuleDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyFormDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyPageFormDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyRuleDetailDTO; |
|||
import com.epmet.dto.form.policy.IcPolicyRuleFormDTO; |
|||
import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO; |
|||
import com.epmet.dto.result.policy.IcPolicyItemResultDTO; |
|||
import com.epmet.entity.*; |
|||
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|||
import com.epmet.service.IcPolicyService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.collections4.MapUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 政策表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-07-18 |
|||
*/ |
|||
@Service |
|||
public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEntity> implements IcPolicyService, ResultDataResolver { |
|||
|
|||
@Autowired |
|||
private IcPolicyRuleDetailDao policyRuleDetailDao; |
|||
@Autowired |
|||
private IcPolicyCategoryDao icPolicyCategoryDao; |
|||
@Autowired |
|||
private IcPolicyRuleDao icPolicyRuleDao; |
|||
@Autowired |
|||
private HeartAttachmentDao heartAttachmentDao; |
|||
@Autowired |
|||
private IcPolicyRuleDetailDao icPolicyRuleDetailDao; |
|||
@Resource |
|||
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|||
|
|||
/** |
|||
* 房屋信息、统计信息查询有哪些可选项 |
|||
* |
|||
* @param customerId |
|||
* @param groupType |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<IcPolicyItemResultDTO> itemList(String customerId, String groupType) { |
|||
if (StringUtils.isBlank(groupType)) { |
|||
return new ArrayList<>(); |
|||
} |
|||
List<IcPolicyItemResultDTO> resultList = baseDao.selectItemList(customerId, groupType); |
|||
if (CollectionUtils.isEmpty(resultList)) { |
|||
return baseDao.selectItemList(Constant.DEFAULT_CUSTOMER, groupType); |
|||
} |
|||
return resultList; |
|||
} |
|||
|
|||
/** |
|||
* 政策管理-新增/修改 |
|||
* |
|||
* @param formDTO |
|||
*/ |
|||
@Transactional(rollbackFor = Exception.class) |
|||
@Override |
|||
public void addOrUpdatePolicy(IcPolicyFormDTO formDTO) { |
|||
// 设置所属组织
|
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|||
if (null == staffInfo || StringUtils.isBlank(staffInfo.getAgencyId())) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "工作人员缓存信息异常", "工作人员信息异常"); |
|||
} |
|||
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|||
// 校验参数
|
|||
checkAddFormDTO(formDTO); |
|||
IcPolicyEntity icPolicyEntity = ConvertUtils.sourceToTarget(formDTO, IcPolicyEntity.class); |
|||
icPolicyEntity.setOrgId(staffInfo.getAgencyId()); |
|||
icPolicyEntity.setOrgIdPath(StringUtils.isNotBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfo.getAgencyId()) : staffInfo.getAgencyId()); |
|||
if (StringUtils.isNotBlank(formDTO.getPolicyId())) { |
|||
icPolicyEntity.setId(formDTO.getPolicyId()); |
|||
baseDao.updateById(icPolicyEntity); |
|||
//删除规则、规则明细、分类、附件
|
|||
icPolicyRuleDao.deleteByIcPolicyId(icPolicyEntity.getId()); |
|||
icPolicyCategoryDao.deleteByIcPolicyId(icPolicyEntity.getId()); |
|||
heartAttachmentDao.deleteByBusinessId(icPolicyEntity.getId()); |
|||
} else { |
|||
// 插入政策主表
|
|||
baseDao.insert(icPolicyEntity); |
|||
} |
|||
// 插入细则
|
|||
int ruleSort = 1; |
|||
for (IcPolicyRuleFormDTO rule : formDTO.getRuleList()) { |
|||
IcPolicyRuleEntity ruleEntity = new IcPolicyRuleEntity(); |
|||
ruleEntity.setCustomerId(formDTO.getCustomerId()); |
|||
ruleEntity.setIcPolicyId(icPolicyEntity.getId()); |
|||
ruleEntity.setRuleName(rule.getRuleName()); |
|||
ruleEntity.setSort(ruleSort); |
|||
icPolicyRuleDao.insert(ruleEntity); |
|||
//删除规则明细
|
|||
icPolicyRuleDetailDao.deleteByRuleId(ruleEntity.getId()); |
|||
|
|||
if (CollectionUtils.isNotEmpty(rule.getResiRuleList())) { |
|||
int resiRuleSort = 1; |
|||
for (IcPolicyRuleDetailDTO ruleDetailDTO : rule.getResiRuleList()) { |
|||
ValidatorUtils.validateEntity(ruleDetailDTO, IcPolicyRuleDetailDTO.ResiRulerShowGroup.class); |
|||
IcPolicyRuleDetailEntity icPolicyRuleDetailEntity = ConvertUtils.sourceToTarget(ruleDetailDTO, IcPolicyRuleDetailEntity.class); |
|||
icPolicyRuleDetailEntity.setCustomerId(formDTO.getCustomerId()); |
|||
icPolicyRuleDetailEntity.setIcPolicyId(icPolicyEntity.getId()); |
|||
icPolicyRuleDetailEntity.setRuleId(ruleEntity.getId()); |
|||
icPolicyRuleDetailEntity.setSort(resiRuleSort); |
|||
icPolicyRuleDetailEntity.setGroupType("resi"); |
|||
icPolicyRuleDetailDao.insert(icPolicyRuleDetailEntity); |
|||
resiRuleSort++; |
|||
} |
|||
} |
|||
if (CollectionUtils.isNotEmpty(rule.getHouseRuleList())) { |
|||
int houseRuleSort = 1; |
|||
for (IcPolicyRuleDetailDTO ruleDetailDTO : rule.getHouseRuleList()) { |
|||
ValidatorUtils.validateEntity(ruleDetailDTO, IcPolicyRuleDetailDTO.HouseRulerShowGroup.class); |
|||
IcPolicyRuleDetailEntity icPolicyRuleDetailEntity = ConvertUtils.sourceToTarget(ruleDetailDTO, IcPolicyRuleDetailEntity.class); |
|||
icPolicyRuleDetailEntity.setCustomerId(formDTO.getCustomerId()); |
|||
icPolicyRuleDetailEntity.setIcPolicyId(icPolicyEntity.getId()); |
|||
icPolicyRuleDetailEntity.setRuleId(ruleEntity.getId()); |
|||
icPolicyRuleDetailEntity.setSort(houseRuleSort); |
|||
icPolicyRuleDetailEntity.setGroupType("house"); |
|||
icPolicyRuleDetailDao.insert(icPolicyRuleDetailEntity); |
|||
houseRuleSort++; |
|||
} |
|||
} |
|||
if (CollectionUtils.isNotEmpty(rule.getStatRuleList())) { |
|||
int statRuleSort = 1; |
|||
for (IcPolicyRuleDetailDTO ruleDetailDTO : rule.getStatRuleList()) { |
|||
ValidatorUtils.validateEntity(ruleDetailDTO, IcPolicyRuleDetailDTO.StatRulerShowGroup.class); |
|||
IcPolicyRuleDetailEntity icPolicyRuleDetailEntity = ConvertUtils.sourceToTarget(ruleDetailDTO, IcPolicyRuleDetailEntity.class); |
|||
icPolicyRuleDetailEntity.setCustomerId(formDTO.getCustomerId()); |
|||
icPolicyRuleDetailEntity.setIcPolicyId(icPolicyEntity.getId()); |
|||
icPolicyRuleDetailEntity.setRuleId(ruleEntity.getId()); |
|||
icPolicyRuleDetailEntity.setSort(statRuleSort); |
|||
icPolicyRuleDetailEntity.setGroupType("stat"); |
|||
icPolicyRuleDetailDao.insert(icPolicyRuleDetailEntity); |
|||
statRuleSort++; |
|||
} |
|||
} |
|||
} |
|||
// 插入分类
|
|||
if (CollectionUtils.isNotEmpty(formDTO.getCategoryList())) { |
|||
for (IcPolicyCategoryDTO categoryDTO : formDTO.getCategoryList()) { |
|||
IcPolicyCategoryEntity icPolicyCategoryEntity = new IcPolicyCategoryEntity(); |
|||
icPolicyCategoryEntity.setCustomerId(formDTO.getCustomerId()); |
|||
icPolicyCategoryEntity.setIcPolicyId(icPolicyEntity.getId()); |
|||
icPolicyCategoryEntity.setCategoryCode(categoryDTO.getCategoryCode()); |
|||
icPolicyCategoryEntity.setCodePath(categoryDTO.getCodePath()); |
|||
icPolicyCategoryDao.insert(icPolicyCategoryEntity); |
|||
} |
|||
} |
|||
// 插入附件
|
|||
if (CollectionUtils.isNotEmpty(formDTO.getAttachmentList())) { |
|||
int sort = 1; |
|||
for (FileCommonDTO fileCommonDTO : formDTO.getAttachmentList()) { |
|||
HeartAttachmentEntity heartAttachment = ConvertUtils.sourceToTarget(fileCommonDTO, HeartAttachmentEntity.class); |
|||
heartAttachment.setCustomerId(formDTO.getCustomerId()); |
|||
heartAttachment.setBusinessId(icPolicyEntity.getId()); |
|||
heartAttachment.setAttachTo("ic_policy"); |
|||
// heartAttachment.setName(fileCommonDTO.getName());
|
|||
// heartAttachment.setFormat(fileCommonDTO.getFormat());
|
|||
// heartAttachment.setType(fileCommonDTO.getType());
|
|||
// heartAttachment.setUrl(fileCommonDTO.getUrl());
|
|||
heartAttachment.setSort(sort); |
|||
heartAttachment.setStatus(Constant.AUTO_PASSED); |
|||
// heartAttachment.setDuration(fileCommonDTO.getDuration());
|
|||
heartAttachmentDao.insert(heartAttachment); |
|||
sort++; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
private void checkAddFormDTO(IcPolicyFormDTO formDTO) { |
|||
//同组织下,政策标题唯一
|
|||
LambdaQueryWrapper<IcPolicyEntity> policyEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|||
policyEntityLambdaQueryWrapper.eq(IcPolicyEntity::getTitle, formDTO.getTitle()) |
|||
.eq(IcPolicyEntity::getOrgId, formDTO.getAgencyId()); |
|||
policyEntityLambdaQueryWrapper.ne(StringUtils.isNotBlank(formDTO.getPolicyId()), IcPolicyEntity::getId, formDTO.getPolicyId()); |
|||
int count = baseDao.selectCount(policyEntityLambdaQueryWrapper); |
|||
if (count > 0) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织内已经存在相同标题的政策", "当前组织内已经存在相同标题的政策"); |
|||
} |
|||
List<IcPolicyRuleFormDTO> ruleList = formDTO.getRuleList(); |
|||
for (IcPolicyRuleFormDTO rule : ruleList) { |
|||
if (CollectionUtils.isEmpty(rule.getResiRuleList()) |
|||
&& CollectionUtils.isEmpty(rule.getHouseRuleList()) |
|||
&& CollectionUtils.isEmpty(rule.getStatRuleList())) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员信息、房屋信息、统计信息任意选择一项填写", "请填写细则明细"); |
|||
} |
|||
} |
|||
// 政策文件最多3个先不限制了吧,前端控制下
|
|||
} |
|||
|
|||
/** |
|||
* 列表查询 |
|||
* |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public PageData<IcPolicyDTO> policyList(IcPolicyPageFormDTO formDTO) { |
|||
// 设置所属组织
|
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|||
if (null == staffInfo || StringUtils.isBlank(staffInfo.getAgencyId())) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "工作人员缓存信息异常", "工作人员信息异常"); |
|||
} |
|||
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); |
|||
List<IcPolicyDTO> list = baseDao.policyList(formDTO.getCustomerId(), staffInfo.getAgencyId(), formDTO.getTitle(), formDTO.getContent(), formDTO.getExpiredFlag()); |
|||
if (CollectionUtils.isNotEmpty(list)) { |
|||
for (IcPolicyDTO icPolicyDTO : list) { |
|||
// 查询字典表
|
|||
Result<Map<String, String>> levelRes = adminOpenFeignClient.dictMap(DictTypeEnum.POLICY_LEVEL.getCode()); |
|||
Map<String, String> levelMap = levelRes.success() && MapUtils.isNotEmpty(levelRes.getData()) ? levelRes.getData() : new HashMap<>(); |
|||
icPolicyDTO.setPolicyLevelName(MapUtils.isNotEmpty(levelMap) && levelMap.containsKey(icPolicyDTO.getPolicyLevel()) ? levelMap.get(icPolicyDTO.getPolicyLevel()) : StrConstant.EPMETY_STR); |
|||
} |
|||
} |
|||
PageInfo<IcPolicyDTO> pageInfo = new PageInfo<>(list); |
|||
return new PageData<>(list, pageInfo.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcPolicyDTO> policyListSelect(String userId, String customerId) { |
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
|||
if (null == staffInfo || StringUtils.isBlank(staffInfo.getAgencyId())) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "工作人员缓存信息异常", "工作人员信息异常"); |
|||
} |
|||
return baseDao.policyList(customerId, staffInfo.getAgencyId(), null, null, null); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcPolicyRuleDTO> ruleList(String customerId, String policyId) { |
|||
LambdaQueryWrapper<IcPolicyRuleEntity> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(IcPolicyRuleEntity::getCustomerId, customerId) |
|||
.eq(IcPolicyRuleEntity::getIcPolicyId, policyId) |
|||
.orderByAsc(IcPolicyRuleEntity::getSort); |
|||
List<IcPolicyRuleEntity> list = icPolicyRuleDao.selectList(wrapper); |
|||
return ConvertUtils.sourceToTarget(list, IcPolicyRuleDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public IcPolicyDTO policyDetail(String customerId, String policyId) { |
|||
IcPolicyEntity policyEntity = baseDao.selectById(policyId); |
|||
IcPolicyDTO icPolicyDTO = ConvertUtils.sourceToTarget(policyEntity, IcPolicyDTO.class); |
|||
if (null != icPolicyDTO) { |
|||
icPolicyDTO.setPolicyId(policyId); |
|||
|
|||
LambdaQueryWrapper<HeartAttachmentEntity> attWrapper = new LambdaQueryWrapper<>(); |
|||
attWrapper.eq(HeartAttachmentEntity::getBusinessId, policyId) |
|||
.orderByAsc(HeartAttachmentEntity::getSort); |
|||
List<HeartAttachmentEntity> attList = heartAttachmentDao.selectList(attWrapper); |
|||
icPolicyDTO.setAttachmentList(CollectionUtils.isNotEmpty(attList) ? ConvertUtils.sourceToTarget(attList, FileCommonDTO.class) : new ArrayList<>()); |
|||
|
|||
LambdaQueryWrapper<IcPolicyCategoryEntity> cateWrapper = new LambdaQueryWrapper<>(); |
|||
cateWrapper.eq(IcPolicyCategoryEntity::getIcPolicyId, policyId); |
|||
List<IcPolicyCategoryEntity> cateList = icPolicyCategoryDao.selectList(cateWrapper); |
|||
icPolicyDTO.setCategoryList(CollectionUtils.isNotEmpty(cateList) ? ConvertUtils.sourceToTarget(cateList, IcPolicyCategoryDTO.class) : new ArrayList<>()); |
|||
|
|||
List<IcPolicyRuleDTO> ruleDTOList = ruleList(customerId, policyId); |
|||
List<IcPolicyRuleFormDTO> ruleList = new ArrayList<>(); |
|||
if (CollectionUtils.isNotEmpty(ruleDTOList)) { |
|||
ruleList = ConvertUtils.sourceToTarget(ruleDTOList, IcPolicyRuleFormDTO.class); |
|||
for (IcPolicyRuleFormDTO rule : ruleList) { |
|||
//人员信息
|
|||
LambdaQueryWrapper<IcPolicyRuleDetailEntity> ruleDetailWrapper = new LambdaQueryWrapper<>(); |
|||
ruleDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|||
.eq(IcPolicyRuleDetailEntity::getGroupType, "resi") |
|||
.orderByAsc(IcPolicyRuleDetailEntity::getSort); |
|||
List<IcPolicyRuleDetailEntity> resiList = icPolicyRuleDetailDao.selectList(ruleDetailWrapper); |
|||
List<IcPolicyRuleDetailDTO> resiRuleList = CollectionUtils.isNotEmpty(resiList) ? ConvertUtils.sourceToTarget(resiList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); |
|||
rule.setResiRuleList(resiRuleList); |
|||
|
|||
//房屋信息
|
|||
LambdaQueryWrapper<IcPolicyRuleDetailEntity> houseDetailWrapper = new LambdaQueryWrapper<>(); |
|||
houseDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|||
.eq(IcPolicyRuleDetailEntity::getGroupType, "house") |
|||
.orderByAsc(IcPolicyRuleDetailEntity::getSort); |
|||
List<IcPolicyRuleDetailEntity> houseList = icPolicyRuleDetailDao.selectList(houseDetailWrapper); |
|||
List<IcPolicyRuleDetailDTO> houseRuleList = CollectionUtils.isNotEmpty(houseList) ? ConvertUtils.sourceToTarget(houseList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); |
|||
rule.setHouseRuleList(houseRuleList); |
|||
|
|||
//统计信息
|
|||
LambdaQueryWrapper<IcPolicyRuleDetailEntity> statDetailWrapper = new LambdaQueryWrapper<>(); |
|||
statDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|||
.eq(IcPolicyRuleDetailEntity::getGroupType, "stat") |
|||
.orderByAsc(IcPolicyRuleDetailEntity::getSort); |
|||
List<IcPolicyRuleDetailEntity> statList = icPolicyRuleDetailDao.selectList(statDetailWrapper); |
|||
List<IcPolicyRuleDetailDTO> statRuleList = CollectionUtils.isNotEmpty(statList) ? ConvertUtils.sourceToTarget(statList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); |
|||
rule.setStatRuleList(statRuleList); |
|||
} |
|||
} |
|||
icPolicyDTO.setRuleList(ruleList); |
|||
} |
|||
return icPolicyDTO; |
|||
} |
|||
|
|||
public Map<String, List<IcPolicyRuleDetailEntity>> listPolicyRules4QueryAndExport(String customerId, String ruleId) { |
|||
ResisByPolicyRulesFormDTO form = new ResisByPolicyRulesFormDTO(); |
|||
LambdaQueryWrapper<IcPolicyRuleDetailEntity> query = new LambdaQueryWrapper(); |
|||
query.eq(IcPolicyRuleDetailEntity::getCustomerId, customerId); |
|||
query.eq(IcPolicyRuleDetailEntity::getRuleId, ruleId); |
|||
query.orderByAsc(IcPolicyRuleDetailEntity::getSort); |
|||
List<IcPolicyRuleDetailEntity> rules = policyRuleDetailDao.selectList(query); |
|||
|
|||
// 将查询出的数据转化成aggre服务能接受的格式
|
|||
return rules.stream().collect(Collectors.groupingBy(IcPolicyRuleDetailEntity::getGroupType, Collectors.toList())); |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
<?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.HeartAttachmentDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.HeartAttachmentEntity" id="heartAttachmentMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="businessId" column="BUSINESS_ID"/> |
|||
<result property="attachTo" column="ATTACH_TO"/> |
|||
<result property="name" column="NAME"/> |
|||
<result property="format" column="FORMAT"/> |
|||
<result property="type" column="TYPE"/> |
|||
<result property="url" column="URL"/> |
|||
<result property="sort" column="SORT"/> |
|||
<result property="status" column="STATUS"/> |
|||
<result property="reason" column="REASON"/> |
|||
<result property="duration" column="DURATION"/> |
|||
<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> |
|||
|
|||
<delete id="deleteByBusinessId" parameterType="java.lang.String"> |
|||
delete from heart_attachment where BUSINESS_ID=#{businessId} |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,23 @@ |
|||
<?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.IcPolicyCategoryDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcPolicyCategoryEntity" id="icPolicyCategoryMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="icPolicyId" column="IC_POLICY_ID"/> |
|||
<result property="categoryCode" column="CATEGORY_CODE"/> |
|||
<result property="codePath" column="CODE_PATH"/> |
|||
<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> |
|||
|
|||
<delete id="deleteByIcPolicyId" parameterType="java.lang.String"> |
|||
delete from ic_policy_category where IC_POLICY_ID=#{icPolicyId} |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,92 @@ |
|||
<?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.IcPolicyDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcPolicyEntity" id="icPolicyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="orgId" column="ORG_ID"/> |
|||
<result property="orgIdPath" column="ORG_ID_PATH"/> |
|||
<result property="policyLevel" column="POLICY_LEVEL"/> |
|||
<result property="startDate" column="START_DATE"/> |
|||
<result property="endDate" column="END_DATE"/> |
|||
<result property="title" column="TITLE"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<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> |
|||
|
|||
<select id="selectItemList" parameterType="map" resultType="com.epmet.dto.result.policy.IcPolicyItemResultDTO"> |
|||
SELECT |
|||
i.id, |
|||
i.GROUP_TYPE, |
|||
i.LABEL, |
|||
i.COL_KEY, |
|||
i.ITEM_TYPE, |
|||
IFNULL( i.TABLE_NAME, '' ) AS TABLE_NAME, |
|||
i.sort, |
|||
IFNULL(i.remark,'')as remark, |
|||
IFNULL(i.option_source_type,'') as option_source_type, |
|||
IFNULL(i.option_source_url,'') as option_source_url, |
|||
IFNULL(i.option_source_param ,'') as option_source_param |
|||
FROM |
|||
ic_policy_item i |
|||
WHERE |
|||
i.DEL_FLAG = '0' |
|||
and i.CUSTOMER_ID = #{customerId} |
|||
and i.GROUP_TYPE = #{groupType} |
|||
order by i.SORT asc |
|||
</select> |
|||
|
|||
<select id="policyList" parameterType="map" resultType="com.epmet.dto.IcPolicyDTO"> |
|||
SELECT |
|||
ip.id AS POLICY_ID, |
|||
ip.ORG_ID, |
|||
ip.POLICY_LEVEL, |
|||
ip.START_DATE, |
|||
ip.END_DATE, |
|||
ip.TITLE, |
|||
ip.CONTENT, |
|||
( |
|||
case when ip.END_DATE < DATE_FORMAT(now(),'%Y-%m-%d') then '1' |
|||
when ip.END_DATE >= DATE_FORMAT(now(),'%Y-%m-%d') then '0' |
|||
end |
|||
)as expiredFlag |
|||
FROM |
|||
ic_policy ip |
|||
WHERE |
|||
ip.DEL_FLAG = '0' |
|||
AND ip.CUSTOMER_ID = #{customerId} |
|||
AND ip.ORG_ID = #{agencyId} |
|||
<if test="null != title and title != '' "> |
|||
and ip.TITLE like concat('%',#{title},'%') |
|||
</if> |
|||
<if test="null != content and content != '' "> |
|||
and ip.CONTENT like concat('%',#{content},'%') |
|||
</if> |
|||
<if test="null != expiredFlag and expiredFlag != '' "> |
|||
and 1=1 |
|||
<if test="expiredFlag == 1"> |
|||
and ip.END_DATE < DATE_FORMAT(now(),'%Y-%m-%d') |
|||
</if> |
|||
<if test="expiredFlag == 0"> |
|||
and ip.END_DATE >= DATE_FORMAT(now(),'%Y-%m-%d') |
|||
</if> |
|||
</if> |
|||
order by ip.CREATED_TIME desc |
|||
</select> |
|||
|
|||
<select id="selectTitle" parameterType="java.lang.String" resultType="java.lang.String"> |
|||
SELECT |
|||
p.TITLE |
|||
FROM |
|||
ic_policy p |
|||
WHERE |
|||
p.id = #{policyId} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,23 @@ |
|||
<?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.IcPolicyRuleDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcPolicyRuleEntity" id="icPolicyRuleMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="icPolicyId" column="IC_POLICY_ID"/> |
|||
<result property="ruleName" column="RULE_NAME"/> |
|||
<result property="sort" column="SORT"/> |
|||
<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> |
|||
|
|||
<delete id="deleteByIcPolicyId" parameterType="java.lang.String"> |
|||
delete from ic_policy_rule where IC_POLICY_ID = #{policyId} |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,33 @@ |
|||
<?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.IcPolicyRuleDetailDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcPolicyRuleDetailEntity" id="icPolicyRuleDetailMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="icPolicyId" column="IC_POLICY_ID"/> |
|||
<result property="ruleId" column="RULE_ID"/> |
|||
<result property="ruleDesc" column="RULE_DESC"/> |
|||
<result property="groupType" column="GROUP_TYPE"/> |
|||
<!-- <result property="lastLogicalRel" column="LAST_LOGICAL_REL"/>--> |
|||
<result property="itemGroupId" column="ITEM_GROUP_ID"/> |
|||
<result property="itemId" column="ITEM_ID"/> |
|||
<result property="queryType" column="QUERY_TYPE"/> |
|||
<result property="colTable" column="COL_TABLE"/> |
|||
<result property="colKey" column="COL_KEY"/> |
|||
<result property="colVal" column="COL_VAL"/> |
|||
<result property="sort" column="SORT"/> |
|||
<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> |
|||
|
|||
<delete id="deleteByRuleId" parameterType="java.lang.String"> |
|||
delete from ic_policy_rule_detail where RULE_ID=#{ruleId} |
|||
</delete> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue