调整
This commit is contained in:
parent
7b1eada5f1
commit
e0c71caa88
@ -0,0 +1,10 @@
|
|||||||
|
package cn.iocoder.yudao.common;
|
||||||
|
/**
|
||||||
|
* 通用常量类
|
||||||
|
* @author PQZ
|
||||||
|
* @date 16:20 2024/8/1
|
||||||
|
**/
|
||||||
|
public class BaseConstants {
|
||||||
|
/**政企客户经办人*/
|
||||||
|
public static final String CUS_TYPE_CORP_ATTN = "04";
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.custom.controller.admin;
|
package cn.iocoder.yudao.module.custom.controller.admin;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||||
@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,8 +116,22 @@ public class CustomerMainController {
|
|||||||
@Operation(summary = "获得客户管理")
|
@Operation(summary = "获得客户管理")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('base:customer-main:query')")
|
@PreAuthorize("@ss.hasPermission('base:customer-main:query')")
|
||||||
public CommonResult<Boolean> getCustomerMain(@RequestParam("id") String id) {
|
public CommonResult<CustomerMainRespVO> getCustomerMain(@RequestParam("id") String id) {
|
||||||
return success(true);
|
return success(customerMainService.getCustomerById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据经办人所属企业查询经办人信息
|
||||||
|
* @author PQZ
|
||||||
|
* @date 16:15 2024/8/2
|
||||||
|
* @param deptCode 经办人所属企业code
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||||
|
**/
|
||||||
|
@GetMapping("/getAttn")
|
||||||
|
@Operation(summary = "根据deptCode获取经办人信息")
|
||||||
|
public CommonResult<List<CustomerMain>> getCustomerMainByDeptCode(@RequestParam("deptCode") String deptCode) {
|
||||||
|
return success(customerMainService.getCustomerByDeptCode(deptCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户管理 Service 接口
|
* 客户管理 Service 接口
|
||||||
*
|
*
|
||||||
@ -36,4 +38,22 @@ public interface CustomerMainService extends IService<CustomerMain> {
|
|||||||
**/
|
**/
|
||||||
void saveCustomer(CustomerMainSaveReqVO saveReqVO);
|
void saveCustomer(CustomerMainSaveReqVO saveReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户id查询客户信息
|
||||||
|
* @author PQZ
|
||||||
|
* @date 15:12 2024/8/2
|
||||||
|
* @param id 客户id
|
||||||
|
* @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO
|
||||||
|
**/
|
||||||
|
CustomerMainRespVO getCustomerById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据经办人所属企业查询经办人信息
|
||||||
|
* @author PQZ
|
||||||
|
* @date 16:15 2024/8/2
|
||||||
|
* @param deptCode 经办人所属企业code
|
||||||
|
* @return java.util.List<cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO>
|
||||||
|
**/
|
||||||
|
List<CustomerMain> getCustomerByDeptCode(String deptCode);
|
||||||
|
|
||||||
}
|
}
|
@ -38,6 +38,10 @@ public class CustomerItemServiceImpl extends ServiceImpl<CustomerItemMapper, Cus
|
|||||||
this.remove(lambdaQueryWrapper);
|
this.remove(lambdaQueryWrapper);
|
||||||
|
|
||||||
/*2、保存扩展信息集合*/
|
/*2、保存扩展信息集合*/
|
||||||
|
itemList.forEach(item -> {
|
||||||
|
item.setId(null);
|
||||||
|
item.setCusId(cusId);
|
||||||
|
});
|
||||||
this.saveBatch(itemList);
|
this.saveBatch(itemList);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.custom.service.impl;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
|
||||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||||
import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper;
|
import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper;
|
||||||
import cn.iocoder.yudao.module.custom.service.CustomerItemService;
|
import cn.iocoder.yudao.module.custom.service.CustomerItemService;
|
||||||
@ -10,6 +12,7 @@ import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
|||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@ -18,6 +21,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.common.BaseConstants.CUS_TYPE_CORP_ATTN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户管理 Service 实现类
|
* 客户管理 Service 实现类
|
||||||
@ -44,7 +51,7 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public IPage<CustomerMainRespVO> queryListPage(CustomerMainPageReqVO pageReqVO, Page<CustomerMainRespVO> page) {
|
public IPage<CustomerMainRespVO> queryListPage(CustomerMainPageReqVO pageReqVO, Page<CustomerMainRespVO> page) {
|
||||||
return customerMainMapper.selectListPage(pageReqVO,page);
|
return customerMainMapper.selectListPage(pageReqVO, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,19 +65,60 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void saveCustomer(CustomerMainSaveReqVO saveReqVO) {
|
public void saveCustomer(CustomerMainSaveReqVO saveReqVO) {
|
||||||
try{
|
try {
|
||||||
/*1、保存主表信息*/
|
/*1、保存主表信息*/
|
||||||
CustomerMain main = JSONUtil.toBean(JSONUtil.parseObj(saveReqVO).toJSONString(0), CustomerMain.class);
|
CustomerMain main = JSONUtil.toBean(JSONUtil.parseObj(saveReqVO).toJSONString(0), CustomerMain.class);
|
||||||
|
//新增情况下,非政企客户经办人,deptCode设置为id,方便分组查询
|
||||||
|
if (null == main.getId() && !CUS_TYPE_CORP_ATTN.equals(main.getTypeCode())) {
|
||||||
|
String id = String.valueOf(UUID.randomUUID());
|
||||||
|
main.setId(id);
|
||||||
|
main.setDeptCode(id);
|
||||||
|
}
|
||||||
this.saveOrUpdate(main);
|
this.saveOrUpdate(main);
|
||||||
/*2、保存扩展表信息*/
|
/*2、保存扩展表信息*/
|
||||||
if (!saveReqVO.getItemList().isEmpty()){
|
if (!saveReqVO.getItemList().isEmpty()) {
|
||||||
customerItemService.saveCutomItem(saveReqVO.getId(),saveReqVO.getItemList());
|
customerItemService.saveCutomItem(main.getId(), saveReqVO.getItemList());
|
||||||
}
|
}
|
||||||
}catch (ServiceException e){
|
} catch (ServiceException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR);
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户id查询客户信息
|
||||||
|
*
|
||||||
|
* @param id 客户id
|
||||||
|
* @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO
|
||||||
|
* @author PQZ
|
||||||
|
* @date 15:12 2024/8/2
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public CustomerMainRespVO getCustomerById(String id) {
|
||||||
|
/*1、主表信息*/
|
||||||
|
CustomerMain main = this.getById(id);
|
||||||
|
/*2、扩展表信息*/
|
||||||
|
LambdaQueryWrapper<CustomerItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(CustomerItem::getCusId, id);
|
||||||
|
List<CustomerItem> itemList = customerItemService.list(lambdaQueryWrapper);
|
||||||
|
CustomerMainRespVO result = JSONUtil.toBean(JSONUtil.parseObj(main).toJSONString(0), CustomerMainRespVO.class);
|
||||||
|
result.setItemList(itemList);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据经办人所属企业查询经办人信息
|
||||||
|
*
|
||||||
|
* @param deptCode 经办人所属企业code
|
||||||
|
* @return java.util.List<cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO>
|
||||||
|
* @author PQZ
|
||||||
|
* @date 16:15 2024/8/2
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<CustomerMain> getCustomerByDeptCode(String deptCode) {
|
||||||
|
LambdaQueryWrapper<CustomerMain> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(CustomerMain::getDeptCode, deptCode).eq(CustomerMain::getTypeCode, CUS_TYPE_CORP_ATTN);
|
||||||
|
return list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.custom.vo;
|
package cn.iocoder.yudao.module.custom.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
|
||||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@ -12,18 +13,12 @@ import com.alibaba.excel.annotation.*;
|
|||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class CustomerMainRespVO extends CustomerMain {
|
public class CustomerMainRespVO extends CustomerMain {
|
||||||
/**客户管理子表id*/
|
|
||||||
private String itemId;
|
|
||||||
/**系统标识*/
|
|
||||||
private String systemCode;
|
|
||||||
/**用户等级*/
|
|
||||||
private String userLevel;
|
|
||||||
/**服务内容*/
|
/**服务内容*/
|
||||||
private String serContent;
|
private String serContents;
|
||||||
/**服务开始时间*/
|
/**车辆数量*/
|
||||||
private Date serTimeStart;
|
private Integer carCount;
|
||||||
/**服务结束时间*/
|
/**扩展信息*/
|
||||||
private Date serTimeEnd;
|
List<CustomerItem> itemList;
|
||||||
/**大json*/
|
|
||||||
private String bigJson;
|
|
||||||
}
|
}
|
@ -28,16 +28,10 @@
|
|||||||
main.inviter AS inviter,
|
main.inviter AS inviter,
|
||||||
main.inviter_type AS inviterType,
|
main.inviter_type AS inviterType,
|
||||||
main.status AS status,
|
main.status AS status,
|
||||||
item.id AS itemId,
|
group_concat(item.ser_content) AS serContents
|
||||||
item.system_code AS systemCode,
|
|
||||||
item.user_level AS userLevel,
|
|
||||||
item.ser_content AS serContent,
|
|
||||||
item.ser_time_start AS serTimeStart,
|
|
||||||
item.ser_time_end AS serTimeEnd,
|
|
||||||
item.big_json AS bigJson
|
|
||||||
FROM
|
FROM
|
||||||
base_customer_main main
|
base_customer_main main
|
||||||
LEFT JOIN base_customer_item item ON main.id = item.cus_id
|
LEFT JOIN base_customer_item item ON main.id = item.cus_id AND item.deleted = 0
|
||||||
<where>
|
<where>
|
||||||
main.deleted = 0
|
main.deleted = 0
|
||||||
<if test="entity.cusName != null and entity.cusName != ''">
|
<if test="entity.cusName != null and entity.cusName != ''">
|
||||||
@ -50,6 +44,7 @@
|
|||||||
AND item.system_code = #{entity.systemCode}
|
AND item.system_code = #{entity.systemCode}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
GROUP BY main.id
|
||||||
ORDER BY main.create_time DESC
|
ORDER BY main.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user