| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package com.goafanti.Interview.controller;
- import com.goafanti.Interview.bo.UpdateUserBo;
- import com.goafanti.Interview.service.UserArchivesInterviewService;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.constant.AFTConstants;
- import com.goafanti.common.controller.BaseController;
- import com.goafanti.common.model.UserArchivesInterview;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.customer.bo.InputUserData;
- import com.goafanti.customer.service.CustomerService;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- /**
- * 客户档案面谈表(UserArchivesInterview)表控制层
- *
- * @author makejava
- * @since 2025-04-10 17:09:23
- */
- @RestController
- @RequestMapping("/api/admin/interview")
- public class UserArchivesInterviewController extends BaseController {
- /**
- * 服务对象
- */
- @Resource
- private UserArchivesInterviewService userArchivesInterviewService;
- @Resource
- private CustomerService customerService;
- /**
- * 新增数据
- *
- * @param in 实体
- * @return 新增结果
- */
- @PostMapping("/add")
- public Result add(UserArchivesInterview in) {
- Result res = new Result();
- if (in.getUid()==null){
- res.getError().add(buildError("客户ID不能为空"));
- return res;
- }
- return res.data(this.userArchivesInterviewService.insert(in));
- }
- /**
- * 通过主键查询单条数据
- *
- * @param id 主键
- * @return 单条数据
- */
- @GetMapping("/get")
- public Result<UserArchivesInterview> queryById(Integer id) {
- return new Result().data(this.userArchivesInterviewService.queryById(id));
- }
- /**
- * 编辑数据
- *
- * @param userArchivesInterview 实体
- * @return 编辑结果
- */
- @PostMapping("/update")
- public Result edit(UserArchivesInterview userArchivesInterview) {
- return new Result().data(this.userArchivesInterviewService.update(userArchivesInterview));
- }
- /**
- * 删除数据
- *
- * @param id 主键
- * @return 删除是否成功
- */
- @GetMapping("/delete")
- public Result deleteById(Integer id) {
- return new Result().data(this.userArchivesInterviewService.deleteById(id));
- }
- /**
- * 客户档案面谈表列表查询
- *
- * @param in 参数
- * @return
- */
- @GetMapping("/list")
- public Result list(UserArchivesInterview in, Integer pageNo, Integer pageSize) {
- Result res = new Result();
- if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)){
- if (in.getUid()==null){
- res.getError().add(buildError("客户ID不能为空"));
- return res;
- }
- }
- return res.data(this.userArchivesInterviewService.list(in, pageNo, pageSize));
- }
- /**
- * 更新企业档案与面谈 /updateUser
- * @return
- */
- @PostMapping("/updateUser")
- public Result updateUser(UpdateUserBo in, InputUserData in2 ) {
- Result res = new Result();
- in.setAid(TokenManager.getAdminId());
- if (in2.getOrgCode()!=null){
- in2.setOrgCode(in2.getOrgCode().trim());
- if (customerService.checkOrgCode(in2.getOrgCode(),in.getUid())){
- res.getError().add(buildError("","统一信用代码已存在"));
- return res;
- }
- }
- if (in.getType()!=2){
- in2.setProvince(in.getLocationProvince());
- in2.setCity(in.getLocationCity());
- in2.setArea(in.getLocationArea());
- in2.setUid(in.getUid());
- customerService.updateUserDate(in2);
- }
- return res.data(this.userArchivesInterviewService.updateUser(in));
- }
- /**
- * 客户档案面谈信息及其他免谈信息
- *
- * @return
- */
- @GetMapping("/selectByPrdid")
- public Result selectByPrdid(Integer prdid) {
- Result res = new Result();
- if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)){
- if (prdid==null){
- res.getError().add(buildError("客户ID不能为空"));
- return res;
- }
- }
- return res.data(this.userArchivesInterviewService.selectByPrdid(prdid));
- }
- }
|