15 changed files with 448 additions and 7 deletions
@ -0,0 +1,17 @@ |
|||||
|
package com.epmet.constant; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 下午1:42 |
||||
|
*/ |
||||
|
public interface SysSmsConstant { |
||||
|
|
||||
|
String IS_NULL_PARAM_LIST = "项目流转或滞留推送短信提醒入参集合为空......"; |
||||
|
|
||||
|
String SELECT_PARAMETER_INFO_FAILURE = "查询客户配置参数失败......"; |
||||
|
|
||||
|
String PARAMETER_INFO_IS_ZERO = "未查到客户配置参数......"; |
||||
|
|
||||
|
String NOT_ENOUGH_BALANCE = "客户:%s ,当前余额为:%s"; |
||||
|
|
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午10:59 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerParameterDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 参数KEY值 |
||||
|
*/ |
||||
|
private String parameterKey; |
||||
|
|
||||
|
/** |
||||
|
* 参数名称 |
||||
|
*/ |
||||
|
private String parameterName; |
||||
|
|
||||
|
/** |
||||
|
* 参数VALUE值 |
||||
|
*/ |
||||
|
private String parameterValue; |
||||
|
|
||||
|
/** |
||||
|
* 说明 |
||||
|
*/ |
||||
|
private String description; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午10:44 |
||||
|
*/ |
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class CrmParameterFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -1892384189805073724L; |
||||
|
|
||||
|
public interface CrmParameterForm{} |
||||
|
|
||||
|
@NotBlank(message = "客户ID不能为空",groups = {CrmParameterForm.class}) |
||||
|
private String customerId; |
||||
|
|
||||
|
@NotBlank(message = "参数KEY值不能为空",groups = {CrmParameterForm.class}) |
||||
|
private String parameterKey; |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午10:46 |
||||
|
*/ |
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class CrmParameterResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8082721392714934568L; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 参数KEY值 |
||||
|
*/ |
||||
|
private String parameterKey; |
||||
|
|
||||
|
/** |
||||
|
* 参数VALUE值 |
||||
|
*/ |
||||
|
private String parameterValue; |
||||
|
|
||||
|
/** |
||||
|
* 余额状态【parameterValue】true:充足,false:不足 |
||||
|
*/ |
||||
|
private Boolean balanceStatus = true; |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.dto.form.CrmParameterFormDTO; |
||||
|
import com.epmet.dto.form.ParameterFormDTO; |
||||
|
import com.epmet.dto.result.CrmParameterResultDTO; |
||||
|
import com.epmet.service.CustomerParameterService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午10:51 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("parameter") |
||||
|
public class CustomerParameterController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerParameterService parameterService; |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询客户配置信息 |
||||
|
* @Param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2021/1/4 上午11:20 |
||||
|
*/ |
||||
|
@PostMapping("parameterinfo") |
||||
|
public Result<List<CrmParameterResultDTO>> selectParamInfo(@RequestBody List<CrmParameterFormDTO> formDTOs){ |
||||
|
formDTOs.forEach(formDTO -> { |
||||
|
ValidatorUtils.validateEntity(formDTO, CrmParameterFormDTO.CrmParameterForm.class); |
||||
|
}); |
||||
|
return new Result<List<CrmParameterResultDTO>>().ok(parameterService.selectParamInfo(formDTOs)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.form.CrmParameterFormDTO; |
||||
|
import com.epmet.dto.result.CrmParameterResultDTO; |
||||
|
import com.epmet.entity.CustomerParameterEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午11:01 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerParameterDao extends BaseDao<CustomerParameterEntity> { |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询客户的配置信息 |
||||
|
* @Param customerIds |
||||
|
* @author zxc |
||||
|
* @date 2021/1/4 上午11:07 |
||||
|
*/ |
||||
|
List<CrmParameterResultDTO> selectParamInfo(@Param("formDTOS")List<CrmParameterFormDTO> formDTOS); |
||||
|
|
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午11:03 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("customer_project_parameter") |
||||
|
public class CustomerParameterEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 参数KEY值 |
||||
|
*/ |
||||
|
private String parameterKey; |
||||
|
|
||||
|
/** |
||||
|
* 参数名称 |
||||
|
*/ |
||||
|
private String parameterName; |
||||
|
|
||||
|
/** |
||||
|
* 参数VALUE值 |
||||
|
*/ |
||||
|
private String parameterValue; |
||||
|
|
||||
|
/** |
||||
|
* 说明 |
||||
|
*/ |
||||
|
private String description; |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.dto.form.CrmParameterFormDTO; |
||||
|
import com.epmet.dto.result.CrmParameterResultDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午10:52 |
||||
|
*/ |
||||
|
public interface CustomerParameterService { |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询客户配置信息 |
||||
|
* @Param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2021/1/4 上午11:20 |
||||
|
*/ |
||||
|
List<CrmParameterResultDTO> selectParamInfo(List<CrmParameterFormDTO> formDTOs); |
||||
|
|
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.epmet.dao.CustomerParameterDao; |
||||
|
import com.epmet.dto.form.CrmParameterFormDTO; |
||||
|
import com.epmet.dto.result.CrmParameterResultDTO; |
||||
|
import com.epmet.service.CustomerParameterService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/1/4 上午10:53 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Slf4j |
||||
|
public class CustomerParameterServiceImpl implements CustomerParameterService { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerParameterDao parameterDao; |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询客户配置信息 |
||||
|
* @Param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2021/1/4 上午11:20 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<CrmParameterResultDTO> selectParamInfo(List<CrmParameterFormDTO> formDTOs) { |
||||
|
if (CollectionUtils.isEmpty(formDTOs)){ |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
List<CrmParameterResultDTO> result = parameterDao.selectParamInfo(formDTOs); |
||||
|
if (CollectionUtils.isEmpty(result)){ |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
<?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.CustomerParameterDao"> |
||||
|
|
||||
|
<!-- 查询客户的配置信息 --> |
||||
|
<select id="selectParamInfo" resultType="com.epmet.dto.result.CrmParameterResultDTO"> |
||||
|
SELECT |
||||
|
CUSTOMER_ID, |
||||
|
PARAMETER_KEY, |
||||
|
PARAMETER_VALUE |
||||
|
FROM customer_parameter |
||||
|
WHERE DEL_FLAG = 0 |
||||
|
AND |
||||
|
<foreach collection="formDTOS" item="formDTO" separator=" OR "> |
||||
|
CUSTOMER_ID = #{formDTO.customerId} |
||||
|
AND PARAMETER_KEY = #{formDTO.parameterKey} |
||||
|
</foreach> |
||||
|
</select> |
||||
|
</mapper> |
Loading…
Reference in new issue