Commit 068a983a authored by 廖旭伟's avatar 廖旭伟

list接口增加时间倒序;新增客户,手机号码唯一

parent 6339c7dc
package com.mortals.xhx.module.customer.service.impl;
import cn.hutool.core.util.PhoneUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
......@@ -33,9 +34,28 @@ import java.util.List;
@Service("customerService")
public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, CustomerEntity, Long> implements CustomerService {
@Override
protected void validData(CustomerEntity entity, Context context) throws AppException {
if(StringUtils.isEmpty(entity.getContactTelphone())){
throw new AppException("手机号不能为空");
}
if(StringUtils.isEmpty(entity.getCustName())){
throw new AppException("姓名不能为空");
}
if(!PhoneUtil.isPhone(entity.getContactTelphone())){
throw new AppException("手机号码格式不正确");
}
}
@Override
protected void saveBefore(CustomerEntity entity, Context context) throws AppException {
this.validData(entity, context);
CustomerEntity query = new CustomerEntity();
query.setContactTelphone(entity.getContactTelphone());
List<CustomerEntity> list = dao.getList(query);
if(CollectionUtils.isNotEmpty(list)){
throw new AppException("手机号码为:"+entity.getContactTelphone()+"的用户已存在");
}
if (StringUtils.isNotEmpty(entity.getPassword())) {
try {
entity.setPassword(SecurityUtil.md5DoubleEncoding(entity.getPassword()));
......
......@@ -45,6 +45,13 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
super.init(model, context);
}
@Override
protected void doListBefore(CustomerEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@Override
public Rest<Object> list(@RequestBody(required = false) CustomerEntity query) {
Map<String, Object> model = new HashMap();
......
package com.mortals.xhx.module.customer.web;
import com.mortals.framework.annotation.UnAuth;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.code.MemberLevelEnum;
import com.mortals.xhx.common.code.TrialAcceptEnum;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import com.mortals.xhx.module.customer.service.CustomerTrialService;
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 org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import com.mortals.xhx.module.customer.model.CustomerTrialQuery;
import com.mortals.xhx.module.customer.service.CustomerTrialService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 客户试用申请
......@@ -56,35 +43,12 @@ public class CustomerTrialController extends BaseCRUDJsonBodyMappingController<C
super.init(model, context);
}
// @Override
// public Rest<Object> list(@RequestBody(required = false) CustomerTrialEntity query) {
// Map<String, Object> model = new HashMap();
// Rest<Object> ret = new Rest();
// Context context = this.getContext();
// String busiDesc = "查询" + this.getModuleDesc();
//
// int code;
// try {
// PageInfo pageInfo = this.buildPageInfo(query);
// this.doListBefore(query, model, context);
// Result result = this.getService().findExt(query, pageInfo, context);
// model.put("data", result.getList());
// model.put("pageInfo", result.getPageInfo());
// this.parsePageInfo(model, result.getPageInfo());
// code = this.doListAfter(query, model, context);
// this.recordSysLog(this.request, busiDesc + " 【成功】");
// } catch (Exception var9) {
// code = -1;
// this.doException(this.request, busiDesc, model, var9);
// }
//
// this.init(model, context);
// ret.setCode(code);
// ret.setData(model);
// ret.setDict(model.get("dict") == null ? null : (Map)model.remove("dict"));
// ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
// return ret;
// }
@Override
protected void doListBefore(CustomerTrialEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@PostMapping({"accept"})
public String accept(@RequestBody CustomerTrialEntity entity) {
......
......@@ -52,6 +52,9 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro
throw new AppException("非法用户,不可访问");
}
query.setCustomerId(this.getCurUser().getId());
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@RequestMapping(value = {"delete/masterplateId"},method = {RequestMethod.POST, RequestMethod.GET})
......
......@@ -55,5 +55,8 @@ public class CustomerWorkDesignStatController extends BaseCRUDJsonBodyMappingCon
throw new AppException("非法用户,不可访问");
}
query.setCustomerId(this.getCurUser().getId());
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
}
\ No newline at end of file
......@@ -55,6 +55,14 @@ public class DesignMasterplateController extends BaseCRUDJsonBodyMappingControll
}
}
@Override
protected void doListBefore(DesignMasterplateEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@Override
protected int doListAfter(DesignMasterplateEntity query, Map<String, Object> model, Context context) throws AppException {
List<DesignMasterplateEntity> resultList = (List<DesignMasterplateEntity>)model.get("data");
if(CollectionUtils.isNotEmpty(resultList)){
......
package com.mortals.xhx.module.font.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.font.model.FontMaterialEntity;
import com.mortals.xhx.module.font.service.FontMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.font.model.FontMaterialEntity;
import com.mortals.xhx.module.font.model.FontMaterialQuery;
import com.mortals.xhx.module.font.service.FontMaterialService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 字体素材
......@@ -48,5 +37,11 @@ public class FontMaterialController extends BaseCRUDJsonBodyMappingController<Fo
super.init(model, context);
}
@Override
protected void doListBefore(FontMaterialEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
}
\ No newline at end of file
package com.mortals.xhx.module.help.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.QuestionStatusEnum;
import com.mortals.xhx.module.help.model.HelpEntity;
import com.mortals.xhx.module.help.service.HelpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
*
......@@ -33,5 +33,11 @@ public class HelpController extends BaseCRUDJsonBodyMappingController<HelpServic
super.init(model, context);
}
@Override
protected void doListBefore(HelpEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
}
\ No newline at end of file
......@@ -57,6 +57,14 @@ public class HelpEvaluateController extends BaseCRUDJsonBodyMappingController<He
entity.setOrganization(customerEntity.getOrganization());
}
@Override
protected void doListBefore(HelpEvaluateEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@Override
protected int doListAfter(HelpEvaluateEntity query, Map<String, Object> model, Context context) throws AppException {
List<HelpEvaluateEntity> evaluateEntities = (List<HelpEvaluateEntity>)model.get("data");
Map<Integer, List<HelpEvaluateEntity>> map = evaluateEntities.stream().collect(Collectors.groupingBy(HelpEvaluateEntity::getEvaluateType));
......
package com.mortals.xhx.module.message.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.MessageTypeEnum;
......@@ -12,6 +13,7 @@ import com.mortals.xhx.module.message.service.MessageService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
*
......@@ -37,6 +39,11 @@ public class MessageController extends BaseCRUDJsonBodyMappingController<Message
super.init(model, context);
}
@Override
protected void doListBefore(MessageEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ import com.mortals.xhx.module.news.service.NewsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
*
......@@ -38,6 +39,9 @@ public class NewsController extends BaseCRUDJsonBodyMappingController<NewsServic
@Override
protected void doListBefore(NewsEntity query, Map<String, Object> model, Context context) throws AppException {
query.setCustomerId(this.getCurUser().getId());
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@Override
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -40,6 +41,9 @@ public class BackgroundMaterialController extends BaseCRUDJsonBodyMappingContro
@Override
protected void doListBefore(PictureMaterialEntity query, Map<String, Object> model, Context context) throws AppException {
query.setPictureType(PictureTypeEnum.BACKGROUND.getValue());
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@Override
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -40,6 +41,9 @@ public class ElementMaterialController extends BaseCRUDJsonBodyMappingControlle
@Override
protected void doListBefore(PictureMaterialEntity query, Map<String, Object> model, Context context) throws AppException {
query.setPictureType(PictureTypeEnum.ELEMENT.getValue());
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@Override
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -41,6 +42,9 @@ public class PictureMaterialController extends BaseCRUDJsonBodyMappingController
@Override
protected void doListBefore(PictureMaterialEntity query, Map<String, Object> model, Context context) throws AppException {
query.setPictureType(PictureTypeEnum.PICTURE.getValue());
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@Override
......
......@@ -66,6 +66,13 @@ public class ProposalController extends BaseCRUDJsonBodyMappingController<Propos
}
@Override
protected void doListBefore(ProposalEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@PostMapping({"reply"})
@RepeatSubmit
public String reply(@RequestBody ProposalEntity entity) {
......
......@@ -43,6 +43,13 @@ public class QuestionController extends BaseCRUDJsonBodyMappingController<Questi
super.init(model, context);
}
@Override
protected void doListBefore(QuestionEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@PostMapping({"evaluate"})
public String evaluate(@RequestBody QuestionEntity entity){
Map<String, Object> model = new HashMap();
......
......@@ -47,6 +47,13 @@ public class QuestionRecordController extends BaseCRUDJsonBodyMappingController<
super.init(model, context);
}
@Override
protected void doListBefore(QuestionRecordEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
@PostMapping({"ask"})
public String ask(@RequestBody QuestionRecordEntity entity) {
......
package com.mortals.xhx.module.question.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.question.model.QuestionReplyEntity;
......@@ -7,6 +8,7 @@ import com.mortals.xhx.module.question.service.QuestionReplyService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
*
......@@ -28,5 +30,11 @@ public class QuestionReplyController extends BaseCRUDJsonBodyMappingController<Q
super.init(model, context);
}
@Override
protected void doListBefore(QuestionReplyEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment