|
@@ -47,6 +47,8 @@ namespace OASystem.API.Controllers
|
|
|
private readonly TranslatorLibraryRepository _translatorRep;
|
|
|
private readonly MediaSuppliersRepository _mediaSupplierRep;
|
|
|
private readonly List<int> _portIds;
|
|
|
+ private readonly BasicInsuranceCostRepository _insuranceCostRep;
|
|
|
+
|
|
|
|
|
|
public ResourceController(
|
|
|
IMapper mapper,
|
|
@@ -68,7 +70,8 @@ namespace OASystem.API.Controllers
|
|
|
TourClientListRepository tourClientListRep,
|
|
|
DelegationInfoRepository delegationInfoRep,
|
|
|
TranslatorLibraryRepository translatorRep,
|
|
|
- MediaSuppliersRepository mediaSupplierRep
|
|
|
+ MediaSuppliersRepository mediaSupplierRep,
|
|
|
+ BasicInsuranceCostRepository insuranceCostRep
|
|
|
)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
@@ -92,6 +95,7 @@ namespace OASystem.API.Controllers
|
|
|
_translatorRep = translatorRep;
|
|
|
_mediaSupplierRep = mediaSupplierRep;
|
|
|
_portIds = new List<int> { 1, 2, 3 };
|
|
|
+ _insuranceCostRep = insuranceCostRep;
|
|
|
}
|
|
|
|
|
|
#region 车公司资料板块
|
|
@@ -4155,7 +4159,6 @@ WHERE
|
|
|
/// 策划部供应商资料
|
|
|
/// Init
|
|
|
/// </summary>
|
|
|
- /// <param name="id"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
@@ -4236,6 +4239,138 @@ WHERE
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region 保险国家基础费用
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 保险国家基础费用
|
|
|
+ /// Info
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> InsuranceCostInfo(InsuranceCostInfoDto dto)
|
|
|
+ {
|
|
|
+ if (!_portIds.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
|
|
|
+
|
|
|
+ if (dto.Id < 1) return Ok(JsonView(false, MsgTips.Port));
|
|
|
+
|
|
|
+ var id = dto.Id;
|
|
|
+ var info = await _insuranceCostRep.Query(x => x.Id == id)
|
|
|
+ .Select(x => new {
|
|
|
+ x.Id,
|
|
|
+ x.IsSchengen,
|
|
|
+ x.CountryName,
|
|
|
+ x.Cost,
|
|
|
+ x.Remark,
|
|
|
+ CreateUserName = SqlFunc.Subqueryable<Sys_Users>().Where(s => s.Id == x.CreateUserId).Select(s => s.CnName).FirstOrDefault(),
|
|
|
+ x.CreateTime
|
|
|
+ })
|
|
|
+ .FirstAsync();
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(info));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 保险国家基础费用
|
|
|
+ /// 分页查询
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> InsuranceCostPageItem(InsuranceCostPageItemDto dto)
|
|
|
+ {
|
|
|
+ if (!_portIds.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
|
|
|
+
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+
|
|
|
+ var data = await _sqlSugar.Queryable<Res_BasicInsuranceCost>()
|
|
|
+ .LeftJoin<Sys_Users>((bic,u) => bic.CreateUserId == u.Id)
|
|
|
+ .Where((bic, u) => bic.IsDel == 0)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Search), (bic, u) => bic.CountryName.Contains(dto.Search))
|
|
|
+ .OrderBy((bic, u) => bic.Id)
|
|
|
+ .Select((bic, u) => new {
|
|
|
+ bic.Id,
|
|
|
+ bic.IsSchengen,
|
|
|
+ bic.CountryName,
|
|
|
+ bic.Cost,
|
|
|
+ bic.Remark,
|
|
|
+ CreateUserName = u.CnName,
|
|
|
+ bic.CreateTime
|
|
|
+ })
|
|
|
+ .ToPageListAsync(dto.PageIndex,dto.PageSize,total);
|
|
|
+
|
|
|
+ return Ok(JsonView(data,total));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 保险国家基础费用
|
|
|
+ /// 操作(添加 Or 编辑)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> InsuranceCostOp(InsuranceCostOpDto dto)
|
|
|
+ {
|
|
|
+ var result = new JsonView() { Code = 400, Msg = "操作失败" };
|
|
|
+ var userId = dto.CurrUserId;
|
|
|
+ if (!_portIds.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
|
|
|
+ if (userId < 1) return Ok(JsonView(false, MsgTips.UserId));
|
|
|
+ var countryName = dto.CountryName.Trim();
|
|
|
+ if (string.IsNullOrEmpty(countryName)) return Ok(JsonView(false,$"国家名称不能为空!"));
|
|
|
+
|
|
|
+ var info = _mapper.Map<Res_BasicInsuranceCost>(dto);
|
|
|
+ info.CreateUserId = dto.CurrUserId;
|
|
|
+ info.CountryName = countryName;
|
|
|
+ if (dto.Id < 1) //添加
|
|
|
+ {
|
|
|
+ var addInfo = await _insuranceCostRep.Query(x => x.CountryName.Equals(countryName)).FirstAsync();
|
|
|
+ if (addInfo != null) return Ok(JsonView(false, $"该国家信息已存在,不可添加!"));
|
|
|
+ var add = await _insuranceCostRep.AddAsync(info);
|
|
|
+ if (add < 1) return Ok(JsonView(false, "添加失败!"));
|
|
|
+ }
|
|
|
+ else //修改
|
|
|
+ {
|
|
|
+ var upd = await _insuranceCostRep.UpdateAsync(x => x.Id == dto.Id, x => new Res_BasicInsuranceCost
|
|
|
+ {
|
|
|
+ IsSchengen = dto.IsSchengen,
|
|
|
+ CountryName = dto.CountryName,
|
|
|
+ Cost = dto.Cost,
|
|
|
+ Remark = dto.Remark
|
|
|
+ });
|
|
|
+ if (!upd) 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> InsuranceCostSoftDel(InsuranceCostSoftDelDto dto)
|
|
|
+ {
|
|
|
+ int userId = dto.CurrUserId, id = dto.Id;
|
|
|
+ if (!_portIds.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
|
|
|
+
|
|
|
+ if (userId < 1) return Ok(JsonView(false, MsgTips.UserId));
|
|
|
+ if (id < 1) return Ok(JsonView(false, MsgTips.Id));
|
|
|
+
|
|
|
+ var del = await _insuranceCostRep.SoftDeleteAsync(x => x.Id == id, userId);
|
|
|
+ if (!del) return Ok(JsonView(false));
|
|
|
+
|
|
|
+ return Ok(JsonView(true));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|
|
|
|