MaTechnicianController.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. package com.ylx.web.controller.massage;
  2. import java.util.LinkedHashMap;
  3. import java.util.List;
  4. import java.util.Objects;
  5. import java.util.Random;
  6. import java.util.concurrent.TimeUnit;
  7. import java.util.regex.Pattern;
  8. import javax.servlet.http.HttpServletRequest;
  9. import javax.servlet.http.HttpServletResponse;
  10. import cn.hutool.json.JSONObject;
  11. import com.alibaba.fastjson.JSON;
  12. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  13. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  14. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  15. import com.ylx.common.core.domain.R;
  16. import com.ylx.common.core.domain.model.LoginUser;
  17. import com.ylx.common.core.domain.model.aliyun.SMSVerificationCode;
  18. import com.ylx.common.core.domain.model.aliyun.SendSmsComponents;
  19. import com.ylx.common.core.domain.model.aliyun.SendSmsEnum;
  20. import com.ylx.common.utils.StringUtils;
  21. import com.ylx.massage.domain.MaProject;
  22. import com.ylx.massage.domain.dto.*;
  23. import com.ylx.massage.domain.dto.MaProjectSaveDto;
  24. import com.ylx.massage.domain.dto.MaProjectUpdateDto;
  25. import com.ylx.massage.domain.dto.MaTechnicianAuditQueryDTO;
  26. import com.ylx.massage.domain.dto.MaTechnicianAuditSubmitDTO;
  27. import com.ylx.massage.domain.dto.MaTechnicianMerchantAddDTO;
  28. import com.ylx.massage.domain.dto.MaTechnicianMerchantQueryDTO;
  29. import com.ylx.massage.domain.vo.*;
  30. import com.ylx.massage.service.IMaProjectService;
  31. import com.ylx.project.domain.Project;
  32. import com.ylx.servicecategory.domain.ServiceCategory;
  33. import com.ylx.servicecategory.service.ServiceCategoryService;
  34. import io.swagger.annotations.Api;
  35. import io.swagger.annotations.ApiOperation;
  36. import org.springframework.data.redis.core.StringRedisTemplate;
  37. import org.springframework.security.access.prepost.PreAuthorize;
  38. import org.springframework.beans.factory.annotation.Autowired;
  39. import org.springframework.transaction.annotation.Transactional;
  40. import org.springframework.util.ObjectUtils;
  41. import org.springframework.web.bind.annotation.*;
  42. import com.ylx.common.annotation.Log;
  43. import com.ylx.common.core.controller.BaseController;
  44. import com.ylx.common.core.domain.AjaxResult;
  45. import com.ylx.common.enums.BusinessType;
  46. import com.ylx.massage.domain.MaTechnician;
  47. import com.ylx.massage.service.IMaTechnicianService;
  48. import com.ylx.common.utils.poi.ExcelUtil;
  49. import com.ylx.common.core.page.TableDataInfo;
  50. import org.springframework.web.multipart.MultipartFile;
  51. /**
  52. * 技师Controller
  53. *
  54. * @author ylx
  55. * @date 2024-03-22
  56. */
  57. @Api("技师管理")
  58. @RestController
  59. @RequestMapping("/technician/technician")
  60. public class MaTechnicianController extends BaseController {
  61. @Autowired
  62. private IMaTechnicianService maTechnicianService;
  63. @Autowired
  64. private StringRedisTemplate redisTemplate;
  65. @Autowired
  66. private SendSmsComponents sendSms;
  67. @Autowired
  68. private ServiceCategoryService serviceCategoryService;
  69. @Autowired
  70. private IMaProjectService maProjectService;
  71. public static final String PHONE_THREEUSERPARTCLIENT_CODE_KEY = "sys:threeUserPartClient:phone:";
  72. @GetMapping("/sendMsg")
  73. @ApiOperation(value = "短信发送", notes = "短信发送")
  74. public Result sendMsg(@RequestParam String phone, HttpServletRequest request) {
  75. if (org.apache.commons.lang3.StringUtils.isEmpty(phone)) {
  76. return Result.error("手机号不能为空");
  77. }
  78. Random rand = new Random();
  79. // randNumber 将被赋值为一个 MIN 和 MAX 范围内的随机数
  80. int randNumber = rand.nextInt(9999 - 1000 + 1) + 1000;
  81. // 保存验证码到redis
  82. redisTemplate.opsForValue()
  83. .set("userH5:order:phone:" + phone, String.valueOf(randNumber), 5L
  84. , TimeUnit.MINUTES);
  85. try {
  86. SMSVerificationCode smsVerificationCode = new SMSVerificationCode(String.valueOf(randNumber));
  87. String jsonString = JSON.toJSONString(smsVerificationCode);
  88. sendSms.sendSms(phone, SendSmsEnum.SMS_220650024, jsonString);
  89. return Result.ok("发送成功");
  90. } catch (Exception e) {
  91. e.printStackTrace();
  92. }
  93. return Result.ok("发送失败");
  94. }
  95. /**
  96. * 商户登录接口
  97. *
  98. * @param thirdPartyLoginsVo
  99. * @return
  100. */
  101. @ApiOperation(value = "商户登录", notes = "商户登录")
  102. @PostMapping(value = "/clientLogin")
  103. @Transactional
  104. public Result<JSONObject> login(@RequestBody ThirdPartyLoginsVo thirdPartyLoginsVo) throws Exception {
  105. // 获取登录用户信息
  106. Result<JSONObject> result = new Result<>();
  107. // 校验手机号是否为空
  108. if (StringUtils.isEmpty(thirdPartyLoginsVo.getPhone())) {
  109. return result.error500("请输入手机号");
  110. }
  111. // 校验用户是否存在且有效
  112. LambdaQueryWrapper<MaTechnician> queryWrapper = new LambdaQueryWrapper<>();
  113. queryWrapper.eq(MaTechnician::getTePhone, thirdPartyLoginsVo.getPhone());
  114. MaTechnician maTechnician = maTechnicianService.getBaseMapper().selectOne(queryWrapper);
  115. // 校验用户是否有效
  116. if (ObjectUtils.isEmpty(maTechnician)) {
  117. return result.error500("商户不存在,请先注册");
  118. }
  119. if (thirdPartyLoginsVo.getCodeSwitch()) {
  120. // 短信验证
  121. String msg = redisTemplate.opsForValue().get(PHONE_THREEUSERPARTCLIENT_CODE_KEY + thirdPartyLoginsVo.getPhone());
  122. if (StringUtils.isEmpty(msg)) {
  123. return Result.error("验证码已失效");
  124. }
  125. if (!thirdPartyLoginsVo.getPhoneMsg().equals(msg)) {
  126. return Result.error("短信验证码不正确");
  127. }
  128. } else {
  129. if (!thirdPartyLoginsVo.getPassWord().equals(maTechnician.getTePassword())) {
  130. return Result.error("密码错误");
  131. }
  132. }
  133. // 登录成功删除验证码
  134. redisTemplate.delete(PHONE_THREEUSERPARTCLIENT_CODE_KEY + thirdPartyLoginsVo.getPhone());
  135. result.success("登录成功");
  136. return result;
  137. }
  138. /**
  139. * 商户忘记密码接口
  140. */
  141. @PostMapping("/resetPassword")
  142. public Result<?> resetPassword(@RequestBody ThirdPartyLoginsVo thirdPartyLoginsVo) {
  143. // 核心正则表达式:
  144. // ^ 表示开头,$ 表示结尾
  145. // [a-zA-Z0-9] 表示只能是字母或数字
  146. // {8,20} 表示长度必须在8到20之间
  147. String regex = "^[a-zA-Z0-9]{8,20}$";
  148. boolean isMatch = Pattern.matches(regex, thirdPartyLoginsVo.getPhoneMsg());
  149. if (!isMatch) {
  150. // 根据需求返回指定的异常提示
  151. return Result.error("请输入8-20位数字/字母组合");
  152. }
  153. // 短信验证
  154. String msg = redisTemplate.opsForValue().get(PHONE_THREEUSERPARTCLIENT_CODE_KEY + thirdPartyLoginsVo.getPhone());
  155. if (StringUtils.isEmpty(msg)) {
  156. return Result.error("验证码已失效");
  157. }
  158. if (!thirdPartyLoginsVo.getPhoneMsg().equals(msg)) {
  159. return Result.error("短信验证码不正确");
  160. }
  161. // 重置密码逻辑
  162. LambdaUpdateWrapper<MaTechnician> updateWrapper = new LambdaUpdateWrapper<>();
  163. updateWrapper.eq(MaTechnician::getTePhone, thirdPartyLoginsVo.getPhone());
  164. updateWrapper.set(MaTechnician::getTePassword, thirdPartyLoginsVo.getPassWord());
  165. maTechnicianService.update(updateWrapper);
  166. redisTemplate.delete(PHONE_THREEUSERPARTCLIENT_CODE_KEY + thirdPartyLoginsVo.getPhone());
  167. return Result.ok("重置密码成功");
  168. }
  169. /**
  170. * 商户入驻申请接口
  171. */
  172. @PostMapping("/apply")
  173. public Result<?> apply(@RequestBody MaTechnicianAppAddVo req) {
  174. // 1. 基础参数校验
  175. if (StringUtils.isAnyBlank(req.getTeName(), req.getTePhone(), req.getTeAddress(), req.getAvatar())) {
  176. return Result.error("必填项不能为空");
  177. }
  178. //校验性别不能为空
  179. if(Objects.isNull(req.getTeSex())){
  180. return Result.error("性别不能为空");
  181. }
  182. // 2. 调用业务层处理入驻申请
  183. maTechnicianService.apply(req);
  184. return Result.ok("提交成功,进入审核流程");
  185. }
  186. /**
  187. * 申请技师文件
  188. * @param req
  189. */
  190. @PostMapping("/applyFile")
  191. public Result applyFile(MerchantApplyFileDto req){
  192. maTechnicianService.applyFile(req);
  193. return Result.ok("上传成功");
  194. }
  195. /**
  196. * 技师状态切换
  197. *
  198. * @param
  199. */
  200. @GetMapping("/switchToOffline")
  201. public Result switchToOffline(@RequestParam Long userId, @RequestParam Boolean forceConfirm){
  202. return maTechnicianService.switchToOffline(userId, forceConfirm);
  203. }
  204. /**
  205. * 查询商户信息接口
  206. */
  207. @GetMapping("/getTechnician")
  208. public Result<?> getTechnician(@RequestParam String phone) {
  209. LambdaQueryWrapper<MaTechnician> queryWrapper = new LambdaQueryWrapper<>();
  210. queryWrapper.eq(MaTechnician::getTePhone, phone);
  211. MaTechnician maTechnician = maTechnicianService.getBaseMapper().selectOne(queryWrapper);
  212. return Result.ok(maTechnician);
  213. }
  214. /**
  215. * 修改和上传商户信息接口
  216. */
  217. @PostMapping("/updateTechnician")
  218. public Result<?> updateTechnician(@RequestBody MaTechnicianAppAddVo req) {
  219. if (req.getAuditStatus() == 0 || req.getAuditStatus() == 3) {
  220. //修改基本信息
  221. updateMaTechnician(req);
  222. }
  223. return Result.ok("修改成功");
  224. }
  225. private void updateMaTechnician(MaTechnicianAppAddVo req) {
  226. LambdaUpdateWrapper<MaTechnician> updateWrapper = new LambdaUpdateWrapper<>();
  227. updateWrapper.eq(MaTechnician::getId, req.getId());
  228. updateWrapper.set(MaTechnician::getTePhone, req.getTePhone());
  229. updateWrapper.set(MaTechnician::getTeName, req.getTeName());
  230. updateWrapper.set(MaTechnician::getOpenService, req.getOpenService());
  231. updateWrapper.set(MaTechnician::getTeAddress, req.getTeAddress());
  232. updateWrapper.set(MaTechnician::getTeAge, req.getTeAge());
  233. updateWrapper.set(MaTechnician::getAvatar, req.getAvatar());
  234. maTechnicianService.update(updateWrapper);
  235. }
  236. /**
  237. * 查询技师列表
  238. */
  239. @PreAuthorize("@ss.hasPermi('technician:technician:list')")
  240. @GetMapping("/list")
  241. public TableDataInfo list(MaTechnician maTechnician) {
  242. startPage();
  243. List<MaTechnician> list = maTechnicianService.selectMaTechnicianList(maTechnician);
  244. return getDataTable(list);
  245. }
  246. /**
  247. * 导出技师列表
  248. */
  249. @PreAuthorize("@ss.hasPermi('technician:technician:export')")
  250. @Log(title = "技师", businessType = BusinessType.EXPORT)
  251. @PostMapping("/export")
  252. public void export(HttpServletResponse response, MaTechnician maTechnician) {
  253. List<MaTechnician> list = maTechnicianService.selectMaTechnicianList(maTechnician);
  254. ExcelUtil<MaTechnician> util = new ExcelUtil<MaTechnician>(MaTechnician.class);
  255. util.exportExcel(response, list, "技师数据");
  256. }
  257. /**
  258. * 获取技师详细信息
  259. */
  260. @PreAuthorize("@ss.hasPermi('technician:technician:query')")
  261. @GetMapping(value = "/{id}")
  262. public AjaxResult getInfo(@PathVariable("id") Long id) {
  263. return success(maTechnicianService.selectMaTechnicianById(id));
  264. }
  265. /**
  266. * 新增技师
  267. */
  268. @ApiOperation("技师入驻")
  269. @PreAuthorize("@ss.hasPermi('technician:technician:add')")
  270. @Log(title = "技师", businessType = BusinessType.INSERT)
  271. @PostMapping
  272. public AjaxResult add(@RequestBody MaTechnicianAppAddVo maTechnicianAppAddVo) {
  273. return toAjax(maTechnicianService.insertMaTechnician(maTechnicianAppAddVo));
  274. }
  275. /**
  276. * 后台新增商户
  277. *
  278. * @param dto 商户新增DTO
  279. * @return AjaxResult 结果
  280. */
  281. @ApiOperation("后台新增商户")
  282. @PreAuthorize("@ss.hasPermi('technician:technician:add')")
  283. @Log(title = "商户", businessType = BusinessType.INSERT)
  284. @PostMapping("/merchant")
  285. public AjaxResult addMerchant(@RequestBody MaTechnicianMerchantAddDTO dto) {
  286. try {
  287. LoginUser loginUser = getLoginUser();
  288. return toAjax(maTechnicianService.insertMerchant(dto, loginUser));
  289. } catch (Exception e) {
  290. e.printStackTrace();
  291. throw new RuntimeException(e);
  292. }
  293. }
  294. /**
  295. * 后台编辑商户
  296. *
  297. * @param id 商户ID
  298. * @param dto 商户编辑DTO
  299. * @return AjaxResult 结果
  300. */
  301. @ApiOperation("后台编辑商户")
  302. @PreAuthorize("@ss.hasPermi('technician:technician:edit')")
  303. @Log(title = "商户", businessType = BusinessType.UPDATE)
  304. @PutMapping("/merchant/{id}")
  305. public AjaxResult editMerchant(@PathVariable("id") Integer id, @RequestBody MaTechnicianMerchantAddDTO dto) {
  306. try {
  307. LoginUser loginUser = getLoginUser();
  308. return toAjax(maTechnicianService.updateMerchant(id, dto, loginUser));
  309. } catch (Exception e) {
  310. e.printStackTrace();
  311. throw new RuntimeException(e);
  312. }
  313. }
  314. /**
  315. * 后台上传商户合同文件
  316. *
  317. * @param id 商户ID
  318. * @param file 合同文件
  319. * @return AjaxResult 上传结果
  320. */
  321. @ApiOperation("后台上传商户合同文件")
  322. @PreAuthorize("@ss.hasPermi('technician:technician:edit')")
  323. @Log(title = "商户合同", businessType = BusinessType.UPDATE)
  324. @PostMapping("/merchant/{id}/contract")
  325. public AjaxResult uploadMerchantContract(@PathVariable("id") Integer id, @RequestParam("file") MultipartFile file) {
  326. try {
  327. LoginUser loginUser = getLoginUser();
  328. return maTechnicianService.uploadMerchantContract(id, file, loginUser);
  329. } catch (Exception e) {
  330. e.printStackTrace();
  331. throw new RuntimeException(e);
  332. }
  333. }
  334. /**
  335. * 查询商户入驻审核列表
  336. *
  337. * @param page 分页参数
  338. * @param dto 查询条件
  339. * @return Page 商户入驻审核分页列表
  340. */
  341. @ApiOperation("后台查询商户入驻审核列表")
  342. @PreAuthorize("@ss.hasPermi('technician:technician:list')")
  343. @GetMapping("/merchant/audit/list")
  344. public R<Page<MaTechnicianAuditListVO>> merchantAuditList(Page<MaTechnicianAuditListVO> page, MaTechnicianAuditQueryDTO dto) {
  345. try {
  346. return R.ok(maTechnicianService.selectMerchantAuditList(page, dto));
  347. } catch (Exception e) {
  348. e.printStackTrace();
  349. throw new RuntimeException(e);
  350. }
  351. }
  352. /**
  353. * 商户入驻审核
  354. *
  355. * @param id 商户ID
  356. * @param dto 审核提交参数
  357. * @return AjaxResult 结果
  358. */
  359. @ApiOperation("商户入驻审核")
  360. @PreAuthorize("@ss.hasPermi('technician:technician:edit')")
  361. @Log(title = "商户入驻审核", businessType = BusinessType.UPDATE)
  362. @PutMapping("/merchant/audit/{id}/submit")
  363. public AjaxResult submitMerchantAudit(@PathVariable("id") Integer id, @RequestBody MaTechnicianAuditSubmitDTO dto) {
  364. try {
  365. LoginUser loginUser = getLoginUser();
  366. return toAjax(maTechnicianService.submitMerchantAudit(id, dto, loginUser));
  367. } catch (Exception e) {
  368. e.printStackTrace();
  369. throw new RuntimeException(e);
  370. }
  371. }
  372. /**
  373. * 查询商户列表
  374. *
  375. * @param page 分页参数
  376. * @param dto 商户查询DTO
  377. * @return Page 商户分页列表
  378. */
  379. @ApiOperation("后台查询商户列表")
  380. @PreAuthorize("@ss.hasPermi('technician:technician:list')")
  381. @GetMapping("/merchant/list")
  382. public R<Page<MaTechnicianMerchantListVO>> merchantList(Page<MaTechnicianMerchantListVO> page, MaTechnicianMerchantQueryDTO dto) {
  383. try {
  384. return R.ok(maTechnicianService.selectMerchantList(page, dto));
  385. } catch (Exception e) {
  386. e.printStackTrace();
  387. throw new RuntimeException(e);
  388. }
  389. }
  390. /**
  391. * 查询商户详情
  392. *
  393. * @param id 商户ID
  394. * @return R<MaTechnicianMerchantDetailVO> 商户详情
  395. */
  396. @ApiOperation("后台查询商户详情")
  397. @PreAuthorize("@ss.hasPermi('technician:technician:query')")
  398. @GetMapping("/merchant/detail/{id}")
  399. public R<MaTechnicianMerchantDetailVO> merchantDetail(@PathVariable("id") Long id) {
  400. try {
  401. return R.ok(maTechnicianService.selectMerchantDetail(id));
  402. } catch (Exception e) {
  403. e.printStackTrace();
  404. throw new RuntimeException(e);
  405. }
  406. }
  407. /**
  408. * 查看商户证照
  409. *
  410. * @param id 商户ID
  411. * @return R<MaTechnicianCertificateVO> 商户证照
  412. */
  413. @ApiOperation("后台查看商户证照")
  414. @PreAuthorize("@ss.hasPermi('technician:technician:query')")
  415. @GetMapping("/merchant/{id}/certificate")
  416. public R<MaTechnicianCertificateVO> merchantCertificate(@PathVariable("id") Integer id) {
  417. try {
  418. return R.ok(maTechnicianService.selectMerchantCertificate(id));
  419. } catch (Exception e) {
  420. e.printStackTrace();
  421. throw new RuntimeException(e);
  422. }
  423. }
  424. /**
  425. * 修改技师
  426. */
  427. @PreAuthorize("@ss.hasPermi('technician:technician:edit')")
  428. @Log(title = "技师", businessType = BusinessType.UPDATE)
  429. @PutMapping
  430. public AjaxResult edit(@RequestBody MaTechnicianAppAddVo maTechnicianAppAddVo) {
  431. return toAjax(maTechnicianService.updateMaTechnician(maTechnicianAppAddVo));
  432. }
  433. /**
  434. * 删除技师
  435. */
  436. @PreAuthorize("@ss.hasPermi('technician:technician:remove')")
  437. @Log(title = "技师", businessType = BusinessType.DELETE)
  438. @DeleteMapping("/{ids}")
  439. public AjaxResult remove(@PathVariable Long[] ids) {
  440. return toAjax(maTechnicianService.deleteMaTechnicianByIds(ids));
  441. }
  442. /**
  443. * 1. 获取服务类目列表 (对应图1、图3)
  444. */
  445. @GetMapping("/getServiceCategoryList")
  446. public AjaxResult getServiceCategoryList() {
  447. List<ServiceCategory> list = serviceCategoryService.listH5ServiceCategory();
  448. return AjaxResult.success(list);
  449. }
  450. /**
  451. * 1. 获取技能列表 (对应图1、图3)
  452. * 支持 Tab 切换:all(全部), active(已开通), applying(申请中), rejected(驳回)
  453. */
  454. @PostMapping("/getSkillList")
  455. public TableDataInfo getSkillList(@RequestBody MaProjectGetVo req) {
  456. startPage();
  457. List<MaProject> list = maTechnicianService.selectMaTechnicianListBy(req.getUserId(), req.getAuditStatus());
  458. if (ObjectUtils.isEmpty(list)) {
  459. List<Project> projectslist = maTechnicianService.selectTechnicianListBy(req.getTypeId());
  460. return getDataTable(projectslist);
  461. } else {
  462. return getDataTable(list);
  463. }
  464. }
  465. /**
  466. * 查询未开通的服务项目列表
  467. *
  468. * @param req
  469. * @return
  470. */
  471. @PostMapping("/getNotApplyList")
  472. public Result<?> getNotApplyList(@RequestBody MaProjectGetVo req) {
  473. return Result.ok(maTechnicianService.getNotApplyList(req.getUserId(), req.getTypeId()));
  474. }
  475. /**
  476. * 申请开通新服务
  477. */
  478. @PostMapping("/applyForService")
  479. public AjaxResult applyForService(@RequestBody MaProjectSaveDto dto) {
  480. return toAjax(maTechnicianService.applyForService(dto));
  481. }
  482. /**
  483. * 重新申请开通新服务
  484. *
  485. * @param req
  486. * @return
  487. */
  488. @PostMapping("/updateApply")
  489. public Result<?> updateApply(@RequestBody MaProjectUpdateDto req) {
  490. if (StringUtils.isNotEmpty(req.getProjectId()) && StringUtils.isNotEmpty(req.getApplyReason())) {
  491. LambdaUpdateWrapper<MaProject> updateWrapper = new LambdaUpdateWrapper<>();
  492. updateWrapper.eq(MaProject::getId, req.getProjectId());
  493. updateWrapper.set(MaProject::getApplyReason, req.getApplyReason());
  494. updateWrapper.set(MaProject::getAuditStatus, 0);
  495. maProjectService.update(updateWrapper);
  496. }
  497. return Result.ok("重新申请成功,提交到审核阶段");
  498. }
  499. /**
  500. * 申请下架,删除服务项目,编辑售价价格
  501. *
  502. * @param req
  503. * @return
  504. */
  505. @PostMapping("/updateMaProject")
  506. public Result<?> updateMaProject(@RequestBody MaProjectUpdateDto req) {
  507. String message = "";
  508. if (StringUtils.isNotEmpty(req.getProjectId())) {
  509. if (req.getIsDelete()) {
  510. LambdaUpdateWrapper<MaProject> updateWrapper = new LambdaUpdateWrapper<>();
  511. updateWrapper.eq(MaProject::getId, req.getProjectId());
  512. updateWrapper.set(MaProject::getIsDelete, 1);
  513. maProjectService.update(updateWrapper);
  514. message = "删除成功";
  515. }
  516. if (req.getIsPass()) {
  517. LambdaUpdateWrapper<MaProject> updateWrapper = new LambdaUpdateWrapper<>();
  518. updateWrapper.eq(MaProject::getId, req.getProjectId());
  519. updateWrapper.set(MaProject::getProjectIsEnable, 1);
  520. maProjectService.update(updateWrapper);
  521. message = "申请下架成功";
  522. }
  523. if (req.getProjectCurrentPrice() != null) {
  524. LambdaUpdateWrapper<MaProject> updateWrapper = new LambdaUpdateWrapper<>();
  525. updateWrapper.eq(MaProject::getId, req.getProjectId());
  526. updateWrapper.set(MaProject::getProjectCurrentPrice, req.getProjectCurrentPrice());
  527. maProjectService.update(updateWrapper);
  528. message = "修改价格完成";
  529. }
  530. }
  531. return Result.ok(message);
  532. }
  533. }