Commit 7efbd46d authored by libin's avatar libin

Merge branch 'master-im' into dev

parents 9f07ac1a e0206f4e
......@@ -11,6 +11,7 @@ import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.mapper.CustomerServiceMapper;
import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -54,32 +55,32 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO, customerService);
if (Objects.isNull(customerServiceDTO.getId())){
customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone()));
customerService.setIsDel(false);
customerService.setPassword(INIT_PASSWORD);
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);
mapper.insertSelective(customerService);
}else {
customerService.setUpdateTime(Instant.now().toEpochMilli());
if (!StringUtils.isEmpty(customerServiceDTO.getPassword())){
userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(),customerServiceDTO.getPassword());
}
mapper.updateByPrimaryKeySelective(customerService);
}
if (Objects.isNull(customerServiceDTO.getId())) {
customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone()));
customerService.setIsDel(false);
customerService.setPassword(StringUtils.isEmpty(customerServiceDTO.getPassword()) ? INIT_PASSWORD : customerServiceDTO.getPassword().trim().length() > 0 ? customerServiceDTO.getPassword() : INIT_PASSWORD);
Map<String, Object> imMap = new HashMap<>(2);
imMap.put("telephone", customerServiceDTO.getTelphone());
imMap.put("password", DigestUtils.md5Hex(customerService.getPassword()));
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);
mapper.insertSelective(customerService);
} else {
customerService.setUpdateTime(Instant.now().toEpochMilli());
if (!StringUtils.isEmpty(customerServiceDTO.getPassword())) {
userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(), customerServiceDTO.getPassword());
}
mapper.updateByPrimaryKeySelective(customerService);
}
}
......@@ -121,24 +122,24 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
public void updatePasswordByPhone(String telphone, String password) {
Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("telphone",telphone);
criteria.andEqualTo("telphone", telphone);
CustomerService customerService = new CustomerService();
customerService.setPassword(password);
customerService.setPassword(DigestUtils.md5Hex(password));
customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByExampleSelective(customerService,example);
mapper.updateByExampleSelective(customerService, example);
}
public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) {
PageDataVO<CustomerServiceVO> dataVO = new PageDataVO<>();
PageDataVO<CustomerServiceVO> dataVO = new PageDataVO<>();
Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",false);
criteria.andEqualTo("isDel", false);
PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page,limit,()->mapper.selectByExample(example));
PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page, limit, () -> mapper.selectByExample(example));
List<CustomerService> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){
if (CollectionUtils.isEmpty(data)) {
return dataVO;
}
......@@ -146,22 +147,22 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerServiceVO customerServiceVO;
for (CustomerService customerService : data) {
customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,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);
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();
CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO();
CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService,customerServiceDTO);
BeanUtils.copyProperties(customerService, customerServiceDTO);
return customerServiceDTO;
}
}
......@@ -74,7 +74,8 @@ public class OrderRentVehicleController extends CommonBaseController {
bo.setAppUserDTO(userFeign.userDetailById(dto.getAppUserId()).getData());
bo.setCrtUser("-1"+ BaseContextHandler.getUserID());
bo.setUseType(null);
//设置-1表示查询所有的车
bo.setUseType(-1);
orderRentVehicleService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder());
}
......
......@@ -130,6 +130,9 @@
</foreach>
</if>
<if test="userId != null">
and b.user_id = #{userId}
</if>
<if test="status != null">
and b.status = #{status}
</if>
......
......@@ -1249,6 +1249,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
public PageDataVO<Vehicle> searchUsableVehicle(RentVehicleBookDTO dto) {
//设置-1表示查询所有的车 由于null json序列化不会赋值过来
if(-1 == dto.getUseType()) {
dto.setUseType(null);
}
Map<String, Object> params = BeanUtil.beanToMap(dto);
List<String> notBookedDates = Lists.newArrayList();
if (StringUtils.isNotBlank(dto.getBookEndDate()) &&
......
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