Add PhoneList by ConnID
This commit is contained in:
parent
ff014be96e
commit
5aa94b9dd6
@ -1,14 +1,12 @@
|
||||
package com.pudonghot.yo.cms.annotation;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author Donghuang <br>
|
||||
* Nov 17, 2019 16:51:56
|
||||
*/
|
||||
@Inherited
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Taggable {
|
||||
|
@ -1,15 +1,13 @@
|
||||
package com.pudonghot.yo.cms.annotation;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* Mark resource is part of tenant
|
||||
* @author Donghuang <br>
|
||||
* Nov 04, 2019 23:06:46
|
||||
*/
|
||||
@Inherited
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TenantResource {
|
||||
|
@ -1,13 +1,7 @@
|
||||
package com.pudonghot.yo.cms.controller;
|
||||
|
||||
import com.pudonghot.yo.cms.annotation.TenantResource;
|
||||
import com.pudonghot.yo.model.domain.IvrMenu;
|
||||
import com.wacai.tigon.form.FormList;
|
||||
import com.wacai.tigon.web.annotation.FilterCol;
|
||||
import com.wacai.tigon.web.annotation.ListApi;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.pudonghot.yo.model.domain.PhoneBlacklist;
|
||||
import com.wacai.tigon.web.controller.BaseCrudController;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneBlacklist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneBlacklist;
|
||||
@ -17,16 +11,9 @@ import com.pudonghot.yo.cms.form.update.FormUpdatePhoneBlacklist;
|
||||
* @date Sep 22, 2020 20:06:35
|
||||
*/
|
||||
@Controller
|
||||
@ListApi(searchCols = {
|
||||
PhoneBlacklist.PHONE,
|
||||
PhoneBlacklist.NOTE
|
||||
})
|
||||
@TenantResource
|
||||
@RequestMapping("/phone-blacklist")
|
||||
public class PhoneBlacklistController
|
||||
extends BaseCrudController<Integer,
|
||||
PhoneBlacklist,
|
||||
FormList,
|
||||
extends PhoneListController<PhoneBlacklist,
|
||||
FormCreatePhoneBlacklist,
|
||||
FormUpdatePhoneBlacklist> {
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
package com.pudonghot.yo.cms.controller;
|
||||
|
||||
import com.wacai.tigon.form.FormList;
|
||||
import com.wacai.tigon.web.annotation.ListApi;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.pudonghot.yo.model.domain.PhoneGreylist;
|
||||
import com.pudonghot.yo.cms.annotation.TenantResource;
|
||||
import com.wacai.tigon.web.controller.BaseCrudController;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneGreylist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneGreylist;
|
||||
@ -15,17 +11,10 @@ import com.pudonghot.yo.cms.form.update.FormUpdatePhoneGreylist;
|
||||
* @date Sep 23, 2020 22:17:01
|
||||
*/
|
||||
@Controller
|
||||
@ListApi(searchCols = {
|
||||
PhoneGreylist.PHONE,
|
||||
PhoneGreylist.NOTE
|
||||
})
|
||||
@TenantResource
|
||||
@RequestMapping("/phone-greylist")
|
||||
public class PhoneGreylistController
|
||||
extends BaseCrudController<Integer,
|
||||
extends PhoneListController<
|
||||
PhoneGreylist,
|
||||
FormList,
|
||||
FormCreatePhoneGreylist,
|
||||
FormUpdatePhoneGreylist> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package com.pudonghot.yo.cms.controller;
|
||||
|
||||
import lombok.val;
|
||||
import java.util.List;
|
||||
import com.wacai.tigon.form.FormList;
|
||||
import com.wacai.tigon.model.ViewModel;
|
||||
import com.wacai.tigon.web.annotation.ListApi;
|
||||
import com.pudonghot.yo.model.domain.PhoneList;
|
||||
import com.wacai.tigon.web.controller.ArgQuery;
|
||||
import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
import com.pudonghot.yo.cms.annotation.TenantResource;
|
||||
import com.wacai.tigon.web.controller.BaseCrudController;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneList;
|
||||
import com.pudonghot.yo.cellphone.privacy.NumberPrivacyUtils;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Sep 22, 2020 20:06:35
|
||||
*/
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Nov 28, 2020 23:24:17
|
||||
*/
|
||||
@ListApi(searchCols = {
|
||||
PhoneList.PHONE,
|
||||
PhoneList.NOTE
|
||||
})
|
||||
@TenantResource
|
||||
public class PhoneListController<M extends PhoneList,
|
||||
FC extends FormCreatePhoneList,
|
||||
FU extends BaseUpdateForm>
|
||||
extends BaseCrudController<Integer,
|
||||
M, FormList, FC, FU> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void after(final ArgQuery<?> arg) {
|
||||
super.after(arg);
|
||||
val type = arg.getType();
|
||||
|
||||
if (type == ArgQuery.Type.FIND) {
|
||||
val data = (PhoneList) arg.getResult().getData();
|
||||
data.setPhone(NumberPrivacyUtils.mask(data.getPhone()));
|
||||
}
|
||||
else if (type == ArgQuery.Type.LIST) {
|
||||
for (val vm : (List<ViewModel<PhoneList>>) arg.getResult().getData()) {
|
||||
val data = vm.getData();
|
||||
data.setPhone(NumberPrivacyUtils.mask(data.getPhone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
package com.pudonghot.yo.cms.controller;
|
||||
|
||||
import com.wacai.tigon.form.FormList;
|
||||
import com.wacai.tigon.web.annotation.ListApi;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.pudonghot.yo.model.domain.PhoneWhitelist;
|
||||
import com.pudonghot.yo.cms.annotation.TenantResource;
|
||||
import com.wacai.tigon.web.controller.BaseCrudController;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneWhitelist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneWhitelist;
|
||||
@ -15,17 +11,9 @@ import com.pudonghot.yo.cms.form.update.FormUpdatePhoneWhitelist;
|
||||
* @date Sep 22, 2020 20:06:30
|
||||
*/
|
||||
@Controller
|
||||
@ListApi(searchCols = {
|
||||
PhoneWhitelist.PHONE,
|
||||
PhoneWhitelist.NOTE
|
||||
})
|
||||
@TenantResource
|
||||
@RequestMapping("/phone-whitelist")
|
||||
public class PhoneWhitelistController
|
||||
extends BaseCrudController<Integer,
|
||||
PhoneWhitelist,
|
||||
FormList,
|
||||
extends PhoneListController<PhoneWhitelist,
|
||||
FormCreatePhoneWhitelist,
|
||||
FormUpdatePhoneWhitelist> {
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
package com.pudonghot.yo.cms.controller;
|
||||
|
||||
import com.pudonghot.yo.cms.auth.SessionAbility;
|
||||
import lombok.val;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
import com.wacai.tigon.model.ViewModel;
|
||||
import com.wacai.tigon.web.controller.ArgQuery;
|
||||
import com.pudonghot.yo.model.domain.Agent;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.wacai.tigon.web.controller.ArgQuery;
|
||||
import com.pudonghot.yo.model.domain.ObjectTag;
|
||||
import com.pudonghot.yo.cms.service.TagService;
|
||||
import com.pudonghot.yo.cms.annotation.Taggable;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.pudonghot.yo.cms.auth.SessionAbility;
|
||||
import com.pudonghot.yo.cms.annotation.TenantResource;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import com.wacai.tigon.web.controller.BaseQueryControllerHook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@ -38,10 +39,10 @@ public class TenantQueryHook implements BaseQueryControllerHook, SessionAbility
|
||||
*/
|
||||
@Override
|
||||
public void before(final ArgQuery<?> arg) {
|
||||
final TenantResource tr = AnnotationUtils.findAnnotation(
|
||||
val tr = AnnotationUtils.findAnnotation(
|
||||
arg.getController(), TenantResource.class);
|
||||
if (tr != null) {
|
||||
final Integer tenantId = getTenantId();
|
||||
val tenantId = getTenantId();
|
||||
if (tr.searchAttr()) {
|
||||
log.debug("Query before: @TenantResource found, add search attr [{}].", tenantId);
|
||||
arg.getSearch().setAttr(
|
||||
@ -54,7 +55,7 @@ public class TenantQueryHook implements BaseQueryControllerHook, SessionAbility
|
||||
}
|
||||
|
||||
// Taggable
|
||||
final Taggable taggable = AnnotationUtils.findAnnotation(
|
||||
val taggable = AnnotationUtils.findAnnotation(
|
||||
arg.getController(), Taggable.class);
|
||||
if (taggable != null) {
|
||||
log.debug("Query before: @Taggable found, add search attr 'withTags'");
|
||||
@ -67,7 +68,7 @@ public class TenantQueryHook implements BaseQueryControllerHook, SessionAbility
|
||||
*/
|
||||
@Override
|
||||
public void after(final ArgQuery<?> arg) {
|
||||
final Taggable taggable = AnnotationUtils.findAnnotation(
|
||||
val taggable = AnnotationUtils.findAnnotation(
|
||||
arg.getController(), Taggable.class);
|
||||
if (taggable != null) {
|
||||
final Integer tenantId = getTenantId();
|
||||
|
@ -2,8 +2,7 @@ package com.pudonghot.yo.cms.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.pudonghot.yo.cms.form.BaseCreateForm;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
@ -11,8 +10,7 @@ import com.pudonghot.yo.cms.form.BaseCreateForm;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class FormCreatePhoneBlacklist extends BaseCreateForm {
|
||||
@ToString(callSuper = true)
|
||||
public class FormCreatePhoneBlacklist extends FormCreatePhoneList {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@NotBlank
|
||||
private String phone;
|
||||
}
|
||||
|
@ -2,11 +2,9 @@ package com.pudonghot.yo.cms.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import com.pudonghot.yo.cms.form.BaseCreateForm;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import lombok.ToString;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
@ -14,11 +12,10 @@ import java.util.Date;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class FormCreatePhoneGreylist extends BaseCreateForm {
|
||||
@ToString(callSuper = true)
|
||||
public class FormCreatePhoneGreylist extends FormCreatePhoneList {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank
|
||||
private String phone;
|
||||
@NotNull
|
||||
private Date fromTime;
|
||||
@NotNull
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.pudonghot.yo.cms.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.pudonghot.yo.cms.form.BaseCreateForm;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Nov 28, 2020 22:58:33
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
public class FormCreatePhoneList extends BaseCreateForm {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@NotBlank
|
||||
private String phone;
|
||||
}
|
@ -2,8 +2,7 @@ package com.pudonghot.yo.cms.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.pudonghot.yo.cms.form.BaseCreateForm;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
@ -11,9 +10,7 @@ import com.pudonghot.yo.cms.form.BaseCreateForm;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class FormCreatePhoneWhitelist extends BaseCreateForm {
|
||||
@ToString(callSuper = true)
|
||||
public class FormCreatePhoneWhitelist extends FormCreatePhoneList {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@NotBlank
|
||||
private String phone;
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.pudonghot.yo.cms.form.update;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import lombok.ToString;
|
||||
import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
|
||||
/**
|
||||
@ -11,9 +11,7 @@ import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
public class FormUpdatePhoneBlacklist extends BaseUpdateForm {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank
|
||||
private String phone;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.pudonghot.yo.cms.form.update;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
import lombok.ToString;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
|
||||
@ -12,6 +13,7 @@ import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
public class FormUpdatePhoneGreylist extends BaseUpdateForm {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@NotNull
|
||||
|
@ -2,7 +2,7 @@ package com.pudonghot.yo.cms.form.update;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import lombok.ToString;
|
||||
import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
|
||||
/**
|
||||
@ -11,9 +11,7 @@ import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
public class FormUpdatePhoneWhitelist extends BaseUpdateForm {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank
|
||||
private String phone;
|
||||
}
|
||||
|
@ -3,15 +3,13 @@ package com.pudonghot.yo.cms.service;
|
||||
import com.pudonghot.yo.model.domain.PhoneBlacklist;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneBlacklist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneBlacklist;
|
||||
import com.wacai.tigon.service.BaseCrudByFormService;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Sep 22, 2020 20:06:35
|
||||
*/
|
||||
public interface PhoneBlacklistService
|
||||
extends BaseCrudByFormService<Integer,
|
||||
PhoneBlacklist,
|
||||
extends PhoneListService<PhoneBlacklist,
|
||||
FormCreatePhoneBlacklist,
|
||||
FormUpdatePhoneBlacklist> {
|
||||
|
||||
|
@ -3,15 +3,13 @@ package com.pudonghot.yo.cms.service;
|
||||
import com.pudonghot.yo.model.domain.PhoneGreylist;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneGreylist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneGreylist;
|
||||
import com.wacai.tigon.service.BaseCrudByFormService;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Sep 23, 2020 22:17:01
|
||||
*/
|
||||
public interface PhoneGreylistService
|
||||
extends BaseCrudByFormService<Integer,
|
||||
PhoneGreylist,
|
||||
extends PhoneListService<PhoneGreylist,
|
||||
FormCreatePhoneGreylist,
|
||||
FormUpdatePhoneGreylist> {
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.pudonghot.yo.cms.service;
|
||||
|
||||
import com.pudonghot.yo.model.domain.PhoneList;
|
||||
import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
import com.wacai.tigon.service.BaseCrudByFormService;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneList;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Nov 28, 2020 23:05:49
|
||||
*/
|
||||
public interface PhoneListService<M extends PhoneList,
|
||||
FC extends FormCreatePhoneList,
|
||||
FU extends BaseUpdateForm>
|
||||
extends BaseCrudByFormService<Integer, M, FC, FU> {
|
||||
}
|
@ -3,15 +3,13 @@ package com.pudonghot.yo.cms.service;
|
||||
import com.pudonghot.yo.model.domain.PhoneWhitelist;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneWhitelist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneWhitelist;
|
||||
import com.wacai.tigon.service.BaseCrudByFormService;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Sep 22, 2020 20:06:30
|
||||
*/
|
||||
public interface PhoneWhitelistService
|
||||
extends BaseCrudByFormService<Integer,
|
||||
PhoneWhitelist,
|
||||
extends PhoneListService<PhoneWhitelist,
|
||||
FormCreatePhoneWhitelist,
|
||||
FormUpdatePhoneWhitelist> {
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.pudonghot.yo.cms.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.pudonghot.yo.model.domain.PhoneBlacklist;
|
||||
import com.pudonghot.yo.mapper.PhoneBlacklistMapper;
|
||||
import com.pudonghot.yo.model.domain.PhoneBlacklist;
|
||||
import com.pudonghot.yo.cms.service.PhoneBlacklistService;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneBlacklist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneBlacklist;
|
||||
import com.wacai.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
@ -14,11 +13,10 @@ import com.wacai.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
*/
|
||||
@Service
|
||||
public class PhoneBlacklistServiceImpl
|
||||
extends BaseCrudByFormServiceSupport<Integer,
|
||||
extends PhoneListServiceImpl<
|
||||
PhoneBlacklist,
|
||||
FormCreatePhoneBlacklist,
|
||||
FormUpdatePhoneBlacklist,
|
||||
PhoneBlacklistMapper>
|
||||
implements PhoneBlacklistService {
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.pudonghot.yo.cms.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.pudonghot.yo.model.domain.PhoneGreylist;
|
||||
import com.pudonghot.yo.mapper.PhoneGreylistMapper;
|
||||
import com.pudonghot.yo.model.domain.PhoneGreylist;
|
||||
import com.pudonghot.yo.cms.service.PhoneGreylistService;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneGreylist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneGreylist;
|
||||
import com.wacai.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
@ -14,11 +13,10 @@ import com.wacai.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
*/
|
||||
@Service
|
||||
public class PhoneGreylistServiceImpl
|
||||
extends BaseCrudByFormServiceSupport<Integer,
|
||||
extends PhoneListServiceImpl<
|
||||
PhoneGreylist,
|
||||
FormCreatePhoneGreylist,
|
||||
FormUpdatePhoneGreylist,
|
||||
PhoneGreylistMapper>
|
||||
implements PhoneGreylistService {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
package com.pudonghot.yo.cms.service.impl;
|
||||
|
||||
import lombok.val;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
import org.springframework.util.Assert;
|
||||
import com.wacai.tigon.model.ViewModel;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.pudonghot.yo.model.domain.PhoneList;
|
||||
import com.pudonghot.yo.cms.form.BaseUpdateForm;
|
||||
import com.pudonghot.yo.cms.service.PhoneListService;
|
||||
import com.pudonghot.yo.mapper.CallDetailRecordMapper;
|
||||
import com.pudonghot.yo.model.domain.CallDetailRecord;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.wacai.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Sep 22, 2020 20:06:35
|
||||
*/
|
||||
@Slf4j
|
||||
public class PhoneListServiceImpl<M extends PhoneList,
|
||||
FC extends FormCreatePhoneList,
|
||||
FU extends BaseUpdateForm,
|
||||
Mapper extends BaseMapper<Integer, M>>
|
||||
extends BaseCrudByFormServiceSupport<Integer, M, FC, FU, Mapper>
|
||||
implements PhoneListService<M, FC, FU> {
|
||||
|
||||
@Autowired
|
||||
private CallDetailRecordMapper callDetailRecordMapper;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Transactional(transactionManager = "transactionManager", rollbackFor = Exception.class)
|
||||
public ViewModel<M> create(final FormCreatePhoneList form) {
|
||||
log.debug("Create form [{}].", form);
|
||||
val phoneLists = validateNumber(form);
|
||||
for (val phoneList : phoneLists) {
|
||||
val phone = phoneList.getPhone();
|
||||
val modelExisted = mapper.find(
|
||||
new Search(PhoneList.TENANT_ID, form.getTenantId())
|
||||
.eq(PhoneList.PHONE, phone));
|
||||
if (modelExisted != null) {
|
||||
form.copy(modelExisted);
|
||||
modelExisted.setPhone(phone);
|
||||
log.info("Update phone list existed [{}].", modelExisted);
|
||||
update(modelExisted);
|
||||
}
|
||||
else {
|
||||
create(phoneList);
|
||||
}
|
||||
}
|
||||
|
||||
return new ViewModel<>(null);
|
||||
}
|
||||
|
||||
String findByConnId(final String connId) {
|
||||
val callDetailRecord = callDetailRecordMapper.find(
|
||||
new Search(CallDetailRecord.CONN_ID, connId).limit(1));
|
||||
return callDetailRecord != null ? callDetailRecord.getCalledNumber() : null;
|
||||
}
|
||||
|
||||
List<M> validateNumber(final FormCreatePhoneList form) {
|
||||
val phones = form.getPhone().split("[^\\w]+");
|
||||
val phoneListList = new ArrayList<M>(phones.length);
|
||||
|
||||
for (val phone : phones) {
|
||||
if (!StringUtils.isNumeric(phone)) {
|
||||
val phone2 = findByConnId(phone);
|
||||
Assert.state(StringUtils.isNotBlank(phone2),
|
||||
() -> "通话ID[" + phone + "]未找到拨打记录");
|
||||
phoneListList.add(createModel(form, phone2));
|
||||
}
|
||||
else {
|
||||
phoneListList.add(createModel(form, phone));
|
||||
}
|
||||
}
|
||||
return phoneListList;
|
||||
}
|
||||
|
||||
private M createModel(final FormCreatePhoneList form, final String phone) {
|
||||
val model = form.copy(modelType);
|
||||
model.setPhone(phone);
|
||||
return model;
|
||||
}
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.pudonghot.yo.cms.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.pudonghot.yo.model.domain.PhoneWhitelist;
|
||||
import com.pudonghot.yo.mapper.PhoneWhitelistMapper;
|
||||
import com.pudonghot.yo.model.domain.PhoneWhitelist;
|
||||
import com.pudonghot.yo.cms.service.PhoneWhitelistService;
|
||||
import com.pudonghot.yo.cms.form.create.FormCreatePhoneWhitelist;
|
||||
import com.pudonghot.yo.cms.form.update.FormUpdatePhoneWhitelist;
|
||||
import com.wacai.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
@ -14,11 +13,10 @@ import com.wacai.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
*/
|
||||
@Service
|
||||
public class PhoneWhitelistServiceImpl
|
||||
extends BaseCrudByFormServiceSupport<Integer,
|
||||
extends PhoneListServiceImpl<
|
||||
PhoneWhitelist,
|
||||
FormCreatePhoneWhitelist,
|
||||
FormUpdatePhoneWhitelist,
|
||||
PhoneWhitelistMapper>
|
||||
implements PhoneWhitelistService {
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,10 @@ public class NumberPrivacyUtils {
|
||||
private static final Pattern HEAVY_PRIVACY_PATTERN =
|
||||
Pattern.compile("(\\w{0,7})\\w{4}$");
|
||||
|
||||
public static String mask(final String number) {
|
||||
return mask(number, PrivacyLevel.HEAVY);
|
||||
}
|
||||
|
||||
public static String mask(final String number, final PrivacyLevel level) {
|
||||
if (level == PrivacyLevel.NONE) {
|
||||
return number;
|
||||
|
@ -2,8 +2,8 @@ package com.pudonghot.yo.model.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
@ -12,11 +12,9 @@ import lombok.experimental.FieldNameConstants;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
@Table("br_phone_blacklist")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class PhoneBlacklist extends TenantDomain {
|
||||
public class PhoneBlacklist extends PhoneList {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotUpdate
|
||||
private String phone;
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package com.pudonghot.yo.model.domain;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
import lombok.ToString;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
@ -13,13 +13,12 @@ import lombok.experimental.FieldNameConstants;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
@Table("br_phone_greylist")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class PhoneGreylist extends TenantDomain {
|
||||
public class PhoneGreylist extends PhoneList {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotUpdate
|
||||
private String phone;
|
||||
private Date fromTime;
|
||||
private Date toTime;
|
||||
private Integer credit;
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.pudonghot.yo.model.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @author Donghuang
|
||||
* @date Nov 28, 2020 22:55:27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class PhoneList extends TenantDomain {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotUpdate
|
||||
private String phone;
|
||||
}
|
@ -2,8 +2,8 @@ package com.pudonghot.yo.model.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
@ -12,11 +12,9 @@ import lombok.experimental.FieldNameConstants;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
@Table("br_phone_whitelist")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class PhoneWhitelist extends TenantDomain {
|
||||
public class PhoneWhitelist extends PhoneList {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotUpdate
|
||||
private String phone;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
<jackson.version>2.9.9.20190807</jackson.version>
|
||||
<spring.version>5.2.5.RELEASE</spring.version>
|
||||
<spring-boot.version>2.2.6.RELEASE</spring-boot.version>
|
||||
<tigon-mybatis.version>0.0.3</tigon-mybatis.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
@ -79,12 +80,12 @@
|
||||
<dependency>
|
||||
<groupId>me.chyxion.tigon</groupId>
|
||||
<artifactId>tigon-mybatis-common</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>${tigon-mybatis.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.chyxion.tigon</groupId>
|
||||
<artifactId>tigon-mybatis</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>${tigon-mybatis.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wacai.tigon</groupId>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.wacai.tigon.web.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@ -8,6 +9,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* @author Donghuang <br>
|
||||
* Sep 12, 2019 17:53:24
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Filter {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.wacai.tigon.web.annotation;
|
||||
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -10,6 +10,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* @author Donghuang <br>
|
||||
* Sep 11, 2019 09:59:32
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface FilterCol {
|
||||
|
@ -6,6 +6,7 @@ import java.lang.annotation.*;
|
||||
* @author Donghuang <br>
|
||||
* Sep 11, 2019 09:59:47
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.wacai.tigon.web.annotation;
|
||||
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -10,6 +11,7 @@ import org.springframework.core.annotation.AliasFor;
|
||||
* @author Donghuang <br>
|
||||
* Sep 12, 2019 17:48:22
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Order {
|
||||
|
@ -1,15 +1,16 @@
|
||||
package com.wacai.tigon.web.annotation;
|
||||
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
/**
|
||||
* @author Donghuang <br>
|
||||
* Sep 11, 2019 10:00:28
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface OrderCol {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#form-content}}
|
||||
<hr />
|
||||
{{form-input name='phone' label='号码'}}
|
||||
{{form-input type='textarea' name='phone' label='号码' placeholder='手机号/通话ID'}}
|
||||
|
||||
{{form-input name='note' label='备注'}}
|
||||
<hr />
|
||||
|
@ -1,6 +1,7 @@
|
||||
{{#form-content}}
|
||||
<hr />
|
||||
{{form-input name='phone' label='号码'}}
|
||||
{{form-input type='textarea' name='phone' label='号码' placeholder='手机号/通话ID'}}
|
||||
|
||||
{{form-input-datetimepicker
|
||||
name='fromTime'
|
||||
label='开始时间'}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#form-content}}
|
||||
<hr />
|
||||
{{form-input name='phone' label='号码'}}
|
||||
{{form-input type='textarea' name='phone' label='号码' placeholder='手机号/通话ID'}}
|
||||
|
||||
{{form-input name='note' label='备注'}}
|
||||
<hr />
|
||||
|
Loading…
x
Reference in New Issue
Block a user