Compare commits

..

2 Commits

15 changed files with 115 additions and 30 deletions

View File

@ -93,7 +93,7 @@ token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
secret: abcdefghijk
# 令牌有效期默认30分钟
expireTime: 30

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cpxt.biz.domain.BizCustomer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/**
* Mapper
@ -14,4 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface BizCustomerMapper extends BaseMapper<BizCustomer>
{ }
{
@Select("select * from biz_customer where linkphone = #{username}")
BizCustomer selectByLinkPhone(String username);
}

View File

@ -60,6 +60,7 @@ public class BizCarModelServiceImpl implements IBizCarModelService
if (ObjectUtil.isNotEmpty(bizCarModel.getName())) {
queryWrapper.like(BizCarModel::getName, bizCarModel.getName());
}
queryWrapper.eq(BizCarModel::getStatus,1);
return queryWrapper;
}
@ -110,9 +111,9 @@ public class BizCarModelServiceImpl implements IBizCarModelService
public int deleteBizCarModelByIds(Long[] ids)
{
UpdateWrapper<BizCarModel> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizCarModelMapper.update(null,updateWrapper);
return bizCarModelMapper.update(updateWrapper);
}
/**

View File

@ -68,6 +68,7 @@ public class BizCarServiceImpl implements IBizCarService
if (ObjectUtil.isNotEmpty(bizCar.getSerialNo())) {
queryWrapper.like(BizCar::getSerialNo, bizCar.getSerialNo());
}
queryWrapper.eq(BizCar::getStatus,1);
return queryWrapper;
}
@ -127,9 +128,9 @@ public class BizCarServiceImpl implements IBizCarService
public int deleteBizCarByIds(Long[] ids)
{
UpdateWrapper<BizCar> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizCarMapper.update(null,updateWrapper);
return bizCarMapper.update(updateWrapper);
}
/**

View File

@ -47,7 +47,7 @@ public class BizCustomerRouteServiceImpl implements IBizCustomerRouteService
public List<BizCustomerRoute> selectBizCustomerRouteList(BizCustomerRoute bizCustomerRoute)
{
LambdaQueryWrapper<BizCustomerRoute> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BizCustomerRoute::getStatus,1);
return bizCustomerRouteMapper.selectList(queryWrapper);
}
@ -85,7 +85,7 @@ public class BizCustomerRouteServiceImpl implements IBizCustomerRouteService
public int deleteBizCustomerRouteByIds(Long[] ids)
{
UpdateWrapper<BizCustomerRoute> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizCustomerRouteMapper.update(null,updateWrapper);
}

View File

@ -8,7 +8,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpxt.biz.domain.BizCarModel;
import com.cpxt.common.core.domain.entity.SysDept;
import com.cpxt.common.core.domain.entity.SysUser;
import com.cpxt.common.utils.DateUtils;
import com.cpxt.system.mapper.SysDeptMapper;
import com.cpxt.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
@ -28,6 +32,12 @@ public class BizCustomerServiceImpl implements IBizCustomerService
@Autowired
private BizCustomerMapper bizCustomerMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SysUserMapper sysUserMapper;
/**
*
*
@ -66,6 +76,7 @@ public class BizCustomerServiceImpl implements IBizCustomerService
if (ObjectUtil.isNotEmpty(bizCustomer.getLevel())){
queryWrapper.eq(BizCustomer::getLevel, bizCustomer.getLevel());
}
queryWrapper.eq(BizCustomer::getStatus,1);
return queryWrapper;
}
@ -91,9 +102,37 @@ public class BizCustomerServiceImpl implements IBizCustomerService
@Override
public int insertBizCustomer(BizCustomer bizCustomer)
{
Long parentId = sysDeptMapper.selectDeptIdByDeptName("外部单位");
Long aLong = sysDeptMapper.selectDeptIdByDeptName(bizCustomer.getName());
SysDept sysDept = new SysDept();
if (ObjectUtil.isEmpty(aLong)){
// 同步创建一个部门,名称为客户名称
sysDept.setParentId(parentId);
sysDept.setAncestors("0," + parentId);
sysDept.setDeptName(bizCustomer.getName());
sysDeptMapper.insertDept(sysDept);
}else {
sysDept.setDeptId(aLong);
}
// 同步新增一个用户
SysUser user = sysUserMapper.selectUserByUserName(bizCustomer.getLinkphone());
if (ObjectUtil.isEmpty(user)){
SysUser sysUser = new SysUser();
setSysUser(bizCustomer,sysUser,sysDept);
sysUserMapper.insertUser(sysUser);
}
return bizCustomerMapper.insert(bizCustomer);
}
private void setSysUser(BizCustomer bizCustomer, SysUser sysUser, SysDept sysDept) {
sysUser.setDeptId(sysDept.getDeptId());
sysUser.setUserName(bizCustomer.getLinkphone());
sysUser.setNickName(bizCustomer.getName());
sysUser.setUserType("2"); // 客户
sysUser.setPhonenumber(bizCustomer.getLinkphone());
sysUser.setPassword(bizCustomer.getLinkphone().substring(7,11)); // 18756576807
}
/**
*
*
@ -115,8 +154,13 @@ public class BizCustomerServiceImpl implements IBizCustomerService
@Override
public int deleteBizCustomerByIds(Long[] ids)
{
// 删除客户对应的用户
for (Long id : ids) {
BizCustomer bizCustomer = bizCustomerMapper.selectById(id);
sysUserMapper.deleteByUserName(bizCustomer.getLinkphone());
}
UpdateWrapper<BizCustomer> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizCustomerMapper.update(null,updateWrapper);
}

View File

@ -78,6 +78,7 @@ public class BizCustomerShopServiceImpl implements IBizCustomerShopService
if (ObjectUtil.isNotEmpty(bizCustomerShop.getLinkphone())){
queryWrapper.like(BizCustomerShop::getLinkphone, bizCustomerShop.getLinkphone());
}
queryWrapper.eq(BizCustomerShop::getStatus,1);
return queryWrapper;
}
@ -115,7 +116,7 @@ public class BizCustomerShopServiceImpl implements IBizCustomerShopService
public int deleteBizCustomerShopByIds(Long[] ids)
{
UpdateWrapper<BizCustomerShop> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizCustomerShopMapper.update(null,updateWrapper);
}

View File

@ -46,6 +46,7 @@ public class BizCustomerUserServiceImpl implements IBizCustomerUserService
public List<BizCustomerUser> selectBizCustomerUserList(BizCustomerUser bizCustomerUser)
{
LambdaQueryWrapper<BizCustomerUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BizCustomerUser::getStatus,1);
return bizCustomerUserMapper.selectList(queryWrapper);
}
@ -83,7 +84,7 @@ public class BizCustomerUserServiceImpl implements IBizCustomerUserService
public int deleteBizCustomerUserByIds(Long[] ids)
{
UpdateWrapper<BizCustomerUser> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizCustomerUserMapper.update(null,updateWrapper);
}

View File

@ -81,6 +81,7 @@ public class BizCustomerWarehouseServiceImpl implements IBizCustomerWarehouseSer
if (ObjectUtil.isNotEmpty(bizCustomerWarehouse.getAddress())){
queryWrapper.like(BizCustomerWarehouse::getAddress, bizCustomerWarehouse.getAddress());
}
queryWrapper.eq(BizCustomerWarehouse::getStatus,1);
return queryWrapper;
}
@ -118,7 +119,7 @@ public class BizCustomerWarehouseServiceImpl implements IBizCustomerWarehouseSer
public int deleteBizCustomerWarehouseByIds(Long[] ids)
{
UpdateWrapper<BizCustomerWarehouse> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizCustomerWarehouseMapper.update(null,updateWrapper);
}

View File

@ -82,6 +82,7 @@ public class BizDriverServiceImpl implements IBizDriverService
if (ObjectUtil.isNotEmpty(bizDriver.getDefaultCarNo())){
queryWrapper.like(BizDriver::getDefaultCarNo, bizDriver.getDefaultCarNo());
}
queryWrapper.eq(BizDriver::getStatus,"1");
return queryWrapper;
}
@ -94,12 +95,16 @@ public class BizDriverServiceImpl implements IBizDriverService
@Override
public int insertBizDriver(BizDriver bizDriver)
{
SysUser sysUser = new SysUser();
setSysUser(bizDriver,sysUser);
sysUserMapper.insertUser(sysUser);
bizDriver.setDeptName(sysDeptMapper.selectDeptById(bizDriver.getDeptId()).getDeptName());
bizDriver.setUserId(sysUser.getUserId());
SysUser user = sysUserMapper.selectUserByUserName(bizDriver.getPhone());
if (ObjectUtil.isEmpty(user)){
SysUser sysUser = new SysUser();
setSysUser(bizDriver,sysUser);
sysUserMapper.insertUser(sysUser);
bizDriver.setUserId(sysUser.getUserId());
}else {
bizDriver.setUserId(user.getUserId());
}
return bizDriverMapper.insert(bizDriver);
}
@ -111,7 +116,7 @@ public class BizDriverServiceImpl implements IBizDriverService
sysUser.setPhonenumber(bizDriver.getPhone());
sysUser.setSex(bizDriver.getGender());
sysUser.setAvatar(bizDriver.getPhoto());
sysUser.setPassword(bizDriver.getIdcard().substring(12,18)); // 340123199906222873
sysUser.setPassword(bizDriver.getPhone().substring(7,11)); // 18756576807
}
/**
@ -135,15 +140,20 @@ public class BizDriverServiceImpl implements IBizDriverService
@Override
public int deleteBizDriverByIds(Long[] ids)
{
// 删除司机对应用户
for (Long id : ids) {
BizDriver bizDriver = bizDriverMapper.selectById(id);
sysUserMapper.deleteByUserName(bizDriver.getPhone());
}
UpdateWrapper<BizDriver> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizDriverMapper.update(null,updateWrapper);
}
/**
*
*
*
* @param id
* @return
*/

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpxt.biz.domain.*;
import com.cpxt.biz.mapper.*;
import com.cpxt.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cpxt.biz.service.IBizOrderService;
@ -253,6 +254,7 @@ public class BizOrderServiceImpl implements IBizOrderService
if (ObjectUtil.isNotEmpty(bizOrder.getArriveLat())){
queryWrapper.eq(BizOrder::getArriveLat, bizOrder.getArriveLat());
}
queryWrapper.eq(BizOrder::getStatus,1);
return queryWrapper;
}
@ -266,6 +268,11 @@ public class BizOrderServiceImpl implements IBizOrderService
public int insertBizOrder(BizOrder bizOrder)
{
Long customerId = bizOrder.getCustomerId(); // 客户id
if (ObjectUtil.isEmpty(customerId)){
String username = SecurityUtils.getUsername();
BizCustomer bizCustomer = bizCustomerMapper.selectByLinkPhone(username);
customerId = bizCustomer.getId();
}
Long routeId = bizOrder.getRouteId(); // 路线id
Long warehouseId = bizOrder.getWarehouseId(); // 仓库id
Long shopId = bizOrder.getShopId(); // 店铺id
@ -274,12 +281,12 @@ public class BizOrderServiceImpl implements IBizOrderService
Long copilotId = bizOrder.getCopilotId(); // 副驾司机id
bizOrder.setCustomerName(bizCustomerMapper.selectById(customerId).getName());
bizOrder.setRouteName(bizCustomerRouteMapper.selectById(routeId).getName());
bizOrder.setWarehouseName(bizCustomerWarehouseMapper.selectById(warehouseId).getName());
bizOrder.setShopName(bizCustomerShopMapper.selectById(shopId).getName());
bizOrder.setCarNo(bizCarMapper.selectById(carId).getCarNo());
bizOrder.setDriverName(bizDriverMapper.selectById(driverId).getName());
bizOrder.setCopilotName(bizDriverMapper.selectById(copilotId).getName());
if (ObjectUtil.isNotEmpty(routeId)) bizOrder.setRouteName(bizCustomerRouteMapper.selectById(routeId).getName());
if (ObjectUtil.isNotEmpty(warehouseId)) bizOrder.setWarehouseName(bizCustomerWarehouseMapper.selectById(warehouseId).getName());
if (ObjectUtil.isNotEmpty(shopId)) bizOrder.setShopName(bizCustomerShopMapper.selectById(shopId).getName());
if (ObjectUtil.isNotEmpty(carId)) bizOrder.setCarNo(bizCarMapper.selectById(carId).getCarNo());
if (ObjectUtil.isNotEmpty(driverId)) bizOrder.setDriverName(bizDriverMapper.selectById(driverId).getName());
if (ObjectUtil.isNotEmpty(copilotId)) bizOrder.setCopilotName(bizDriverMapper.selectById(copilotId).getName());
return bizOrderMapper.insert(bizOrder);
}
@ -305,7 +312,7 @@ public class BizOrderServiceImpl implements IBizOrderService
public int deleteBizOrderByIds(Long[] ids)
{
UpdateWrapper<BizOrder> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids);
updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除
return bizOrderMapper.update(null,updateWrapper);
}

View File

@ -115,4 +115,7 @@ public interface SysDeptMapper
* @return
*/
public int deleteDeptById(Long deptId);
Long selectDeptIdByDeptName(String deptName);
}

View File

@ -124,4 +124,6 @@ public interface SysUserMapper
* @return
*/
public SysUser checkEmailUnique(String email);
public int deleteByUserName(String userName);
}

View File

@ -86,7 +86,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<select id="selectDeptIdByDeptName" resultType="java.lang.Long">
select dept_id from sys_dept where dept_name = #{deptName}
</select>
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>

View File

@ -214,12 +214,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<delete id="deleteByUserName">
update sys_user set del_flag = '2' where user_name = #{userName}
</delete>
</mapper>