123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using Microsoft.AspNetCore.Mvc;
- using OASystem.Domain.Dtos.CRM;
- using OASystem.Domain.Entities.Customer;
- using OASystem.Infrastructure.Repositories.CRM;
- using static OASystem.Domain.Dtos.CRM.NewClientDataQueryDto;
- namespace OASystem.API.Controllers
- {
- /// <summary>
- /// 市场客户资料
- /// </summary>
- [Route("api/[controller]/[action]")]
- public class MarketCustomerResourcesController : ControllerBase
- {
- private readonly NewClientDataRepository _clientDataRepository;
- /// <summary>
- /// 初始化
- /// </summary>
- public MarketCustomerResourcesController(NewClientDataRepository clientDataRepository)
- {
- this._clientDataRepository = clientDataRepository;
- }
- /// <summary>
- /// 查询客户资料数据
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryNewClientData(NewClientDataQueryDto dto)
- {
- JsonView jw = new JsonView();
- try
- {
- Result resultData = await _clientDataRepository.QueryNewClientData(dto);
- if (resultData.Code == 0)
- {
- jw = JsonView(true, resultData.Msg, resultData.Data);
- }
- else
- {
- jw = JsonView(false, resultData.Msg, resultData.Data);
- }
- }
- catch (Exception)
- {
- jw = JsonView(false, "程序错误!");
- }
- return Ok(jw);
- }
- /// <summary>
- /// 客户资料操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> NewClientOp(NewClientOpDto dto)
- {
- try
- {
- Domain.Result result = await _clientDataRepository.NewClientOp(dto);
- if (result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- return Ok(JsonView(true, result.Msg));
- }
- catch (Exception)
- {
- return Ok(JsonView(false, "程序错误!"));
- }
- }
- /// <summary>
- /// 新客户资料操作(删除)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> NewClientDel(DelBaseDto dto)
- {
- var res = await _clientDataRepository.DelNewClientData(dto);
- if (res.Code != 0)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- /// <summary>
- /// 获取下拉列表数据和单条数据信息
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QuerySelectAndSingleData(QuerySingleDto dto)
- {
- JsonView jw = new JsonView();
- var result = await _clientDataRepository.QuerySelectAndSingleData(dto);
- if (result.Code == 0)
- {
- jw = JsonView(true, result.Msg,result.Data);
- }
- else
- {
- jw = JsonView(false, result.Msg);
- }
- return Ok(jw);
- }
- /// <summary>
- /// 获取现有负责人
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryUserSelect()
- {
- try
- {
- Result resTable = _clientDataRepository.QueryUserSelect();
- return Ok(JsonView(true, resTable.Msg, resTable.Data));
- }
- catch (Exception)
- {
- return Ok(JsonView(false, "程序错误!"));
- }
- }
- /// <summary>
- /// 获取出团数据
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryNumberGroups()
- {
- var result = await _clientDataRepository.QueryNumberGroups();
- if (result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- return Ok(JsonView(true, result.Msg,result.Data));
- }
- }
- }
|