Commit 09ebe880 authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/dev' into dev

parents 483e5010 4ba6d368
...@@ -96,6 +96,10 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -96,6 +96,10 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(campsiteShopFindDTO.getPage(), campsiteShopFindDTO.getLimit(), () -> mapper.findAllCampsiteShopsByTypeOrCode(campsiteShopFindDTO.getType(),campsiteShopFindDTO.getAddrProvince(),campsiteShopFindDTO.getAddrCity())); PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(campsiteShopFindDTO.getPage(), campsiteShopFindDTO.getLimit(), () -> mapper.findAllCampsiteShopsByTypeOrCode(campsiteShopFindDTO.getType(),campsiteShopFindDTO.getAddrProvince(),campsiteShopFindDTO.getAddrCity()));
List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData(); List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData();
if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) { if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) {
campsiteShopPageDataVO.setPageNum(campsiteShopFindDTO.getPage());
campsiteShopPageDataVO.setTotalCount(0L);
campsiteShopPageDataVO.setTotalPage(0);
campsiteShopPageDataVO.setPageSize(campsiteShopFindDTO.getLimit());
campsiteShopPageDataVO.setData(Collections.EMPTY_LIST); campsiteShopPageDataVO.setData(Collections.EMPTY_LIST);
return campsiteShopPageDataVO; return campsiteShopPageDataVO;
} }
......
...@@ -37,12 +37,28 @@ ...@@ -37,12 +37,28 @@
<!--根据类型查询全部--> <!--根据类型查询全部-->
<select id="findAllCampsiteShopsByTypeOrCode" resultType="com.xxfc.platform.campsite.dto.CampsiteShopPageDTO"> <select id="findAllCampsiteShopsByTypeOrCode" resultType="com.xxfc.platform.campsite.dto.CampsiteShopPageDTO">
select cs.id as `id`,cs.name as `name`,cs.logo as `logo`,cs.url as `url`,cs.province_name as `provinceName`,cs.city_name as `cityName`,cs.service_phone as `phone`,cs.alt SELECT
cs.longitude as `longitude`,cs.latitude as `latitude`,`address` as `address`,cs.hot as `hot`,cs.crt_time as `crtTime`,cs.concat as `concat`,ct.id as `storeId`,ct.name as `storeTypeName` cs.id AS `id`,
FROM `campsite_shop_tag` cst cs. NAME AS `name`,
left JOIN `campsite_shop` cs on cst.shop_id=cs.id cs.logo AS `logo`,
left JOIN `campsite_tag` ct on cst.tag_id=ct.id cs.url AS `url`,
where cs.sale_state=1 and cs.is_del=0 cs.province_name AS `provinceName`,
cs.city_name AS `cityName`,
cs.service_phone AS `phone`,
cs.longitude AS `longitude`,
cs.latitude AS `latitude`,
cs.`address` AS `address`,
cs.hot AS `hot`,
cs.crt_time AS `crtTime`,
cs.concat AS `concat`,
REPLACE(GROUP_CONCAT( DISTINCT ct.`name` ),',','|') AS `storeTypeName`
FROM campsite_shop cs
LEFT JOIN campsite_shop_tag cst ON cs.id = cst.shop_id
LEFT JOIN campsite_tag ct ON cst.tag_id = ct.id
WHERE
cs.sale_state = 1
AND cs.is_del = 0
<if test="typeId!=null"> <if test="typeId!=null">
and cst.tag_id=#{typeId} and cst.tag_id=#{typeId}
</if> </if>
...@@ -52,6 +68,7 @@ ...@@ -52,6 +68,7 @@
<if test="cityCode != null"> <if test="cityCode != null">
and `city`=#{cityCode} and `city`=#{cityCode}
</if> </if>
GROUP BY cs.id
order by `crtTime` DESC order by `crtTime` DESC
</select> </select>
......
...@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor; ...@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor;
public class CustomerServiceDTO { public class CustomerServiceDTO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String id; private Long id;
/** /**
* 客服名称 * 客服名称
......
package com.xxfc.platform.im.model; package com.xxfc.platform.im.entity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.mongodb.morphia.annotations.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field; import org.springframework.data.mongodb.core.mapping.Field;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Table;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -18,11 +23,15 @@ import org.springframework.data.mongodb.core.mapping.Field; ...@@ -18,11 +23,15 @@ import org.springframework.data.mongodb.core.mapping.Field;
@Builder(toBuilder = true) @Builder(toBuilder = true)
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Entity
@Table(name = "customer_service")
@Document(collection = "customer_service") @Document(collection = "customer_service")
public class CustomerService { public class CustomerService {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
private String id; @javax.persistence.Id
@GeneratedValue(generator = "JDBC")
private Long id;
/** /**
* 客服名称 * 客服名称
*/ */
...@@ -35,21 +44,25 @@ public class CustomerService { ...@@ -35,21 +44,25 @@ public class CustomerService {
* App id * App id
*/ */
@Field("app_user_id") @Field("app_user_id")
@Column(name = "app_user_id")
private Integer appUserId; private Integer appUserId;
/** /**
* im id * im id
*/ */
@Field("im_user_id") @Field("im_user_id")
@Column(name = "im_user_id")
private Integer imUserId; private Integer imUserId;
/** /**
* 区域id * 区域id
*/ */
@Field("area_id") @Field("area_id")
@Column(name = "area_id")
private Integer areaId; private Integer areaId;
/** /**
* 区域名称 * 区域名称
*/ */
@Field("area_name") @Field("area_name")
@Column(name = "area_name")
private String areaName; private String areaName;
/** /**
* 问候语句 * 问候语句
...@@ -63,16 +76,23 @@ public class CustomerService { ...@@ -63,16 +76,23 @@ public class CustomerService {
* 客服电话 * 客服电话
*/ */
private String telphone; private String telphone;
/**
* 登录密码
*/
private String password;
/** /**
* 是事删除 true:删除状态 1:正常 * 是事删除 true:删除状态 1:正常
*/ */
@Field("is_del") @Field("is_del")
@Column(name = "is_del")
private Boolean isDel; private Boolean isDel;
@Field("create_time") @Field("create_time")
@Column(name = "create_time")
private Long createTime; private Long createTime;
@Field("update_time") @Field("update_time")
@Column(name = "update_time")
private Long updateTime; private Long updateTime;
} }
...@@ -20,7 +20,7 @@ import java.io.Serializable; ...@@ -20,7 +20,7 @@ import java.io.Serializable;
public class CustomerServiceVO implements Serializable { public class CustomerServiceVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String id; private Long id;
/** /**
* 客服名称 * 客服名称
......
...@@ -2,34 +2,24 @@ package com.xxfc.platform.im.biz; ...@@ -2,34 +2,24 @@ package com.xxfc.platform.im.biz;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.constant.UserConstant; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse; import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.mongodb.client.result.UpdateResult; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.im.dto.CustomerServiceDTO; import com.xxfc.platform.im.dto.CustomerServiceDTO;
import com.xxfc.platform.im.model.CustomerService; import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.model.User; import com.xxfc.platform.im.mapper.CustomerServiceMapper;
import com.xxfc.platform.im.repos.CustomerServiceRepository;
import com.xxfc.platform.im.vo.CustomerServiceVO; import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static org.springframework.data.mongodb.core.query.Query.query;
import static org.springframework.data.mongodb.core.query.Update.update;
/** /**
* @author libin * @author libin
...@@ -39,95 +29,139 @@ import static org.springframework.data.mongodb.core.query.Update.update; ...@@ -39,95 +29,139 @@ import static org.springframework.data.mongodb.core.query.Update.update;
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CustomerServiceBiz { public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerService> {
private final static String INIT_PASSWORD="12345678";
private final static String NICK_PRE_NAME="XXKF"; private final static String INIT_PASSWORD = "12345678";
private final CustomerServiceRepository customerServiceRepository; private final static String NICK_PRE_NAME = "XXKF";
private final MongoTemplate mongoTemplate;
private final UserBiz userBiz; private final UserBiz userBiz;
public CustomerServiceVO findById(String id){ public CustomerServiceVO findById(Long id) {
CustomerServiceVO customerServiceVO = new CustomerServiceVO(); CustomerServiceVO customerServiceVO = new CustomerServiceVO();
customerServiceRepository.findById(id).ifPresent(customerService -> { CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService,customerServiceVO); BeanUtils.copyProperties(customerService, customerServiceVO);
}); return customerServiceVO;
Map<Integer, User> imMap = userBiz.findAllByImUserIds(Arrays.asList(customerServiceVO.getImUserId())); }
User user = imMap.get(customerServiceVO.getImUserId());
customerServiceVO.setPassword(user.getPassword());
return customerServiceVO;
}
/** /**
* 添加客服 * 添加客服
*
* @param customerServiceDTO * @param customerServiceDTO
*/ */
public void addCustomerService(CustomerServiceDTO customerServiceDTO){ public void addCustomerService(CustomerServiceDTO customerServiceDTO) {
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO,customerService); BeanUtils.copyProperties(customerServiceDTO, customerService);
customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s",NICK_PRE_NAME,customerServiceDTO.getTelphone())); if (Objects.isNull(customerServiceDTO.getId())){
customerService.setIsDel(false); customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone()));
Map<String,Object> imMap = new HashMap<>(2); customerService.setIsDel(false);
imMap.put("telephone",customerServiceDTO.getTelphone()); customerService.setPassword(INIT_PASSWORD);
imMap.put("password",INIT_PASSWORD); Map<String, Object> imMap = new HashMap<>(2);
imMap.put("nickname",customerService.getName()); imMap.put("telephone", customerServiceDTO.getTelphone());
BaseResponse imResponse = userBiz.register(imMap); imMap.put("password", INIT_PASSWORD);
String imResult = imResponse.getMessage(); imMap.put("nickname", customerService.getName());
JSONObject jsonObject = JSON.parseObject(imResult); BaseResponse imResponse = userBiz.register(imMap);
Map<String,Object> data = (Map<String, Object>) jsonObject.get("data"); String imResult = imResponse.getMessage();
Object userId = data.get("userId"); JSONObject jsonObject = JSON.parseObject(imResult);
if (Objects.isNull(userId)){ Map<String, Object> data = (Map<String, Object>) jsonObject.get("data");
throw new BaseException("注册失败"); Object userId = data.get("userId");
if (Objects.isNull(userId)) {
throw new BaseException("注册失败");
}
customerService.setImUserId((Integer) userId);
mapper.insertSelective(customerService);
}else {
customerService.setUpdateTime(Instant.now().toEpochMilli());
if (!StringUtils.isEmpty(customerServiceDTO.getPassword())){
userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(),customerServiceDTO.getPassword());
}
mapper.updateByPrimaryKeySelective(customerService);
} }
customerService.setImUserId((Integer)userId);
customerServiceRepository.save(customerService);
}
/**
* 1: mongoTemplate.find(Query.query(Criteria.where("isDel").is(false)), CustomerService.class); }
*
* 2. customerServiceRepository.findByIsDelEquals(false);
* @return
*/
public List<CustomerServiceVO> findAll() { public List<CustomerServiceVO> findAll() {
List<CustomerServiceVO> customerServiceVOS = new ArrayList<>(); List<CustomerServiceVO> customerServiceVOS = new ArrayList<>();
CustomerService customer_service = new CustomerService(); Example example = new Example(CustomerService.class);
Example<CustomerService> customerServiceExample = Example.of(customer_service, ExampleMatcher.matchingAll()); Example.Criteria criteria = example.createCriteria();
List<CustomerService> customerServices = customerServiceRepository.findAll(customerServiceExample); criteria.andEqualTo("isDel", 0);
List<CustomerService> customerServices = mapper.selectByExample(example);
CustomerServiceVO customerServiceVO;
if (CollectionUtils.isNotEmpty(customerServices)){ if (CollectionUtils.isNotEmpty(customerServices)) {
List<Integer> imUserIds = customerServices.stream().map(CustomerService::getImUserId).collect(Collectors.toList()); CustomerServiceVO customerServiceVO;
Map<Integer, User> imMap = userBiz.findAllByImUserIds(imUserIds); for (CustomerService customerService : customerServices) {
for (CustomerService customerService : customerServices) { customerServiceVO = new CustomerServiceVO();
customerServiceVO = new CustomerServiceVO(); BeanUtils.copyProperties(customerService, customerServiceVO);
BeanUtils.copyProperties(customerService,customerServiceVO); customerServiceVOS.add(customerServiceVO);
User user = imMap.get(customerService.getImUserId()); }
if (Objects.nonNull(user)){ }
customerServiceVO.setPassword(user.getPassword());
}
customerServiceVOS.add(customerServiceVO);
}
}
return customerServiceVOS; return customerServiceVOS;
} }
/** /**
* 删除客服 * 删除客服
*
* @param id * @param id
* @param imUserId * @param imUserId
*/ */
public void updateCustomerServiceIsDelToTrue(String id,Integer imUserId){ public void updateCustomerServiceIsDelToTrue(Long id, Integer imUserId) {
Query query = query(Criteria.where("_id").is(id)); CustomerService customerService = new CustomerService();
Update update = update("is_del", true).set("update_time",Instant.now().toEpochMilli()); customerService.setId(id);
mongoTemplate.updateFirst(query, update, Map.class, "customer_service"); customerService.setIsDel(true);
customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByPrimaryKeySelective(customerService);
userBiz.deleteById(imUserId); userBiz.deleteById(imUserId);
} }
public void updatePasswordByPhone(String telphone, String password) {
Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("telphone",telphone);
CustomerService customerService = new CustomerService();
customerService.setPassword(password);
customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByExampleSelective(customerService,example);
}
public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) {
PageDataVO<CustomerServiceVO> dataVO = new PageDataVO<>();
Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("is_del",false);
PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page,limit,()->mapper.selectByExample(example));
List<CustomerService> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){
return dataVO;
}
List<CustomerServiceVO> customerServiceVOS = new ArrayList<>();
CustomerServiceVO customerServiceVO;
for (CustomerService customerService : data) {
customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,customerServiceVO);
customerServiceVOS.add(customerServiceVO);
}
dataVO.setPageSize(pageDataVO.getPageSize());
dataVO.setPageNum(pageDataVO.getPageNum());
dataVO.setTotalPage(pageDataVO.getTotalPage());
dataVO.setTotalCount(pageDataVO.getTotalCount());
dataVO.setData(customerServiceVOS);
return dataVO;
}
public CustomerServiceDTO findCustomerServiceById(Long id) {
CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO();
CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService,customerService);
return customerServiceDTO;
}
} }
package com.xxfc.platform.im.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.xxfc.platform.im.dto.CustomerServiceDTO;
import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.model.User;
import com.xxfc.platform.im.repos.CustomerServiceRepository;
import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
import static org.springframework.data.mongodb.core.query.Query.query;
import static org.springframework.data.mongodb.core.query.Update.update;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 9:49
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CustomerServiceMGBiz {
private final static String INIT_PASSWORD="12345678";
private final static String NICK_PRE_NAME="XXKF";
private final CustomerServiceRepository customerServiceRepository;
private final MongoTemplate mongoTemplate;
private final UserBiz userBiz;
public CustomerServiceVO findById(String id){
CustomerServiceVO customerServiceVO = new CustomerServiceVO();
customerServiceRepository.findById(id).ifPresent(customerService -> {
BeanUtils.copyProperties(customerService,customerServiceVO);
});
Map<Integer, User> imMap = userBiz.findAllByImUserIds(Arrays.asList(customerServiceVO.getImUserId()));
User user = imMap.get(customerServiceVO.getImUserId());
customerServiceVO.setPassword(user.getPassword());
return customerServiceVO;
}
/**
* 添加客服
* @param customerServiceDTO
*/
public void addCustomerService(CustomerServiceDTO customerServiceDTO){
CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO,customerService);
customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s",NICK_PRE_NAME,customerServiceDTO.getTelphone()));
customerService.setIsDel(false);
Map<String,Object> imMap = new HashMap<>(2);
imMap.put("telephone",customerServiceDTO.getTelphone());
imMap.put("password",INIT_PASSWORD);
imMap.put("nickname",customerService.getName());
BaseResponse imResponse = userBiz.register(imMap);
String imResult = imResponse.getMessage();
JSONObject jsonObject = JSON.parseObject(imResult);
Map<String,Object> data = (Map<String, Object>) jsonObject.get("data");
Object userId = data.get("userId");
if (Objects.isNull(userId)){
throw new BaseException("注册失败");
}
customerService.setImUserId((Integer)userId);
customerServiceRepository.save(customerService);
}
/**
* 1: mongoTemplate.find(Query.query(Criteria.where("isDel").is(false)), CustomerService.class);
*
* 2. customerServiceRepository.findByIsDelEquals(false);
* @return
*/
public List<CustomerServiceVO> findAll() {
List<CustomerServiceVO> customerServiceVOS = new ArrayList<>();
CustomerService customer_service = new CustomerService();
Example<CustomerService> customerServiceExample = Example.of(customer_service, ExampleMatcher.matchingAll());
List<CustomerService> customerServices = customerServiceRepository.findAll(customerServiceExample);
CustomerServiceVO customerServiceVO;
if (CollectionUtils.isNotEmpty(customerServices)){
List<Integer> imUserIds = customerServices.stream().map(CustomerService::getImUserId).collect(Collectors.toList());
Map<Integer, User> imMap = userBiz.findAllByImUserIds(imUserIds);
for (CustomerService customerService : customerServices) {
customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,customerServiceVO);
User user = imMap.get(customerService.getImUserId());
if (Objects.nonNull(user)){
customerServiceVO.setPassword(user.getPassword());
}
customerServiceVOS.add(customerServiceVO);
}
}
return customerServiceVOS;
}
/**
* 删除客服
* @param id
* @param imUserId
*/
public void updateCustomerServiceIsDelToTrue(String id,Integer imUserId){
Query query = query(Criteria.where("_id").is(id));
Update update = update("is_del", true).set("update_time",Instant.now().toEpochMilli());
mongoTemplate.updateFirst(query, update, Map.class, "customer_service");
userBiz.deleteById(imUserId);
}
}
package com.xxfc.platform.im.mapper;
import com.xxfc.platform.im.entity.CustomerService;
import tk.mybatis.mapper.common.Mapper;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/9 9:55
*/
public interface CustomerServiceMapper extends Mapper<CustomerService> {
}
package com.xxfc.platform.im.repos; package com.xxfc.platform.im.repos;
import com.xxfc.platform.im.model.CustomerService; import com.xxfc.platform.im.entity.CustomerService;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query; import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.im.rest; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.im.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.im.biz.CustomerServiceBiz; import com.xxfc.platform.im.biz.CustomerServiceBiz;
import com.xxfc.platform.im.biz.CustomerServiceMGBiz;
import com.xxfc.platform.im.vo.CustomerServiceVO; import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,16 +23,19 @@ import java.util.List; ...@@ -22,16 +23,19 @@ import java.util.List;
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/app/unauth/customer_service") @RequestMapping("/app/unauth/customer_service")
public class CustomerServiceController { public class CustomerServiceController {
private final CustomerServiceMGBiz customerServiceMGBiz;
private final CustomerServiceBiz customerServiceBiz; private final CustomerServiceBiz customerServiceBiz;
@GetMapping("/list") @GetMapping("/list")
public ObjectRestResponse<List<CustomerServiceVO>> findAll(){ public ObjectRestResponse<List<CustomerServiceVO>> findAll(){
// List<CustomerServiceVO> customerServiceVOS = customerServiceMGBiz.findAll();
List<CustomerServiceVO> customerServiceVOS = customerServiceBiz.findAll(); List<CustomerServiceVO> customerServiceVOS = customerServiceBiz.findAll();
return ObjectRestResponse.succ(customerServiceVOS); return ObjectRestResponse.succ(customerServiceVOS);
} }
@GetMapping("/{id}") @GetMapping("/{id}")
public ObjectRestResponse<CustomerServiceVO> findById(@PathVariable(value = "id") String id){ public ObjectRestResponse<CustomerServiceVO> findById(@PathVariable(value = "id") Long id){
// CustomerServiceVO customerServiceVO = customerServiceMGBiz.findById(id);
CustomerServiceVO customerServiceVO = customerServiceBiz.findById(id); CustomerServiceVO customerServiceVO = customerServiceBiz.findById(id);
return ObjectRestResponse.succ(customerServiceVO); return ObjectRestResponse.succ(customerServiceVO);
} }
......
package com.xxfc.platform.im.rest.admin; package com.xxfc.platform.im.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.im.biz.CustomerServiceBiz; import com.xxfc.platform.im.biz.CustomerServiceBiz;
import com.xxfc.platform.im.biz.CustomerServiceMGBiz;
import com.xxfc.platform.im.biz.UserBiz; import com.xxfc.platform.im.biz.UserBiz;
import com.xxfc.platform.im.dto.CustomerServiceDTO; import com.xxfc.platform.im.dto.CustomerServiceDTO;
import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -19,13 +22,28 @@ import org.springframework.web.bind.annotation.*; ...@@ -19,13 +22,28 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/admin/customer_service") @RequestMapping("/admin/customer_service")
public class CustomerServiceAdminController { public class CustomerServiceAdminController {
private final CustomerServiceMGBiz customerServiceMGBiz;
private final CustomerServiceBiz customerServiceBiz; private final CustomerServiceBiz customerServiceBiz;
private final UserBiz userBiz; private final UserBiz userBiz;
@GetMapping("/page")
public ObjectRestResponse<PageDataVO<CustomerServiceVO>> findCustomerServiceWithPage(@RequestParam(value = "page") Integer page,
@RequestParam(value = "limit") Integer limit) {
PageDataVO<CustomerServiceVO> pageDataVO = customerServiceBiz.findCustomerServiceWithPage(page,limit);
return ObjectRestResponse.succ(pageDataVO);
}
@GetMapping("/{id}")
public ObjectRestResponse<CustomerServiceDTO> findCustomerService(@PathVariable(value = "id") Long id){
CustomerServiceDTO customerServiceDTO = customerServiceBiz.findCustomerServiceById(id);
return ObjectRestResponse.succ(customerServiceDTO);
}
@PostMapping("/add") @PostMapping("/add")
public ObjectRestResponse<Void> addCustomerService(@RequestBody CustomerServiceDTO customerServiceDTO){ public ObjectRestResponse<Void> addCustomerService(@RequestBody CustomerServiceDTO customerServiceDTO){
// customerServiceMGBiz.addCustomerService(customerServiceDTO);
customerServiceBiz.addCustomerService(customerServiceDTO); customerServiceBiz.addCustomerService(customerServiceDTO);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -34,12 +52,14 @@ public class CustomerServiceAdminController { ...@@ -34,12 +52,14 @@ public class CustomerServiceAdminController {
public ObjectRestResponse<Void> updateCustomerService(@PathVariable(value = "telphone") String telphone, public ObjectRestResponse<Void> updateCustomerService(@PathVariable(value = "telphone") String telphone,
@PathVariable(value = "password") String password){ @PathVariable(value = "password") String password){
userBiz.updatePasswordByPhone(telphone,password); userBiz.updatePasswordByPhone(telphone,password);
customerServiceBiz.updatePasswordByPhone(telphone,password);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@DeleteMapping("/delete/{id}/{imUserId}") @DeleteMapping("/delete/{id}/{imUserId}")
public ObjectRestResponse<Void> deleteCustomerService(@PathVariable(value = "id") String id, public ObjectRestResponse<Void> deleteCustomerService(@PathVariable(value = "id") Long id,
@PathVariable(value = "imUserId") Integer imUserId){ @PathVariable(value = "imUserId") Integer imUserId){
// customerServiceMGBiz.updateCustomerServiceIsDelToTrue(id,imUserId);
customerServiceBiz.updateCustomerServiceIsDelToTrue(id,imUserId); customerServiceBiz.updateCustomerServiceIsDelToTrue(id,imUserId);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
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