小程序端:实名认证功能,入驻修改,master已取消订单查询问题修复

This commit is contained in:
donqi 2022-07-07 15:32:11 +08:00
parent 60778ba082
commit eb49ce9f71
11 changed files with 254 additions and 116 deletions

View File

@ -1,23 +1,30 @@
package com.ghy.worker.controller;
package com.ghy.web.controller.worker;
import java.util.List;
import com.ghy.common.annotation.Log;
import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.page.TableDataInfo;
import com.ghy.common.enums.BusinessType;
import com.ghy.common.enums.WorkerCertifyStatus;
import com.ghy.common.enums.WorkerStatus;
import com.ghy.common.utils.ExceptionUtil;
import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.system.domain.SysArea;
import com.ghy.system.service.ISysAreaService;
import com.ghy.worker.domain.Worker;
import com.ghy.worker.domain.WorkerCertification;
import com.ghy.worker.service.IWorkerCertificationService;
import com.ghy.worker.service.WorkerService;
import com.ghy.worker.service.WorkerSpecialSkillService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ghy.common.annotation.Log;
import com.ghy.common.enums.BusinessType;
import com.ghy.worker.domain.WorkerCertification;
import com.ghy.worker.service.IWorkerCertificationService;
import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.common.core.page.TableDataInfo;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 师傅实名审核Controller
@ -34,6 +41,15 @@ public class WorkerCertificationController extends BaseController
@Autowired
private IWorkerCertificationService workerCertificationService;
@Autowired
private WorkerSpecialSkillService workerSpecialSkillService;
@Autowired
private ISysAreaService sysAreaService;
@Autowired
private WorkerService workerService;
@RequiresPermissions("worker:certification:view")
@GetMapping()
public String certification()
@ -124,4 +140,47 @@ public class WorkerCertificationController extends BaseController
{
return toAjax(workerCertificationService.deleteWorkerCertificationByWorkerCertificationIds(ids));
}
@PostMapping("/app/add")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public AjaxResult appAddCertify(@RequestBody WorkerCertification request) {
try {
// 将师傅状态设置为冻结
Worker worker = new Worker();
worker.setWorkerId(request.getWorkerId());
worker.setStatus(WorkerStatus.DISABLE.getCode());
int updateRows = workerService.updateWorker(worker);
Assert.isTrue(updateRows == 1, "实名认证记录新增失败");
// 删除存在的认证记录
workerCertificationService.deleteCertificationByWorkerId(request.getWorkerId());
// 插入新的认证记录
request.setStatus(WorkerCertifyStatus.AUDITING.getCode());
int insertRows = workerCertificationService.insertWorkerCertification(request);
Assert.isTrue(insertRows == 1, "实名认证记录新增失败");
// 入驻特殊技能信息持久化
workerSpecialSkillService.updateWorkerSpecialSkill(request.getWorkerId(), request.getSpecialSkills());
return AjaxResult.success("保存成功");
} catch (Exception e) {
e.printStackTrace();
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/app/getByWorkerId")
@ResponseBody
public AjaxResult getByWorkerId(@RequestBody WorkerCertification request) {
try {
WorkerCertification workerCertification = workerCertificationService.selectByWorkerId(request.getWorkerId());
workerCertification.setSpecialSkills(workerSpecialSkillService.getByWorker(request.getWorkerId()));
SysArea sysArea = sysAreaService.selectById(workerCertification.getCompanyCountryId());
workerCertification.setMergerName(sysArea.getMergerName());
return AjaxResult.success(workerCertification);
} catch (Exception e) {
e.printStackTrace();
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error(e.getMessage());
}
}
}

View File

@ -207,7 +207,6 @@ public class WorkerController extends BaseController {
@Transactional(rollbackFor = Exception.class)
public AjaxResult settled(@RequestBody WorkerSettledRequest request) {
try {
// TODO:参数校验
// 入驻区域信息持久化
workerAreaService.updateWorkerServArea(request.getWorkerId(), request.getWorkerAreas());
// 入驻服务品类信息持久化
@ -226,30 +225,4 @@ public class WorkerController extends BaseController {
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/certify")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public AjaxResult certify(@RequestBody WorkerSettledRequest request) {
try {
// 校验是否已绑定银行信息
WorkerBank workerBank = workerBankService.getByWorkerId(request.getWorkerId());
if (workerBank == null) {
return AjaxResult.error("银行卡未绑定");
}
// 入驻特殊技能信息持久化
specialSkillService.updateWorkerSpecialSkill(request.getWorkerId(), request.getSpecialSkills());
// 更新师傅状态为审核中
Worker worker = new Worker();
worker.setWorkerId(request.getWorkerId());
worker.setStatus(WorkerStatus.AUDITING.getCode());
workerService.updateWorker(worker);
return AjaxResult.success("保存成功");
} catch (Exception e) {
e.printStackTrace();
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error(e.getMessage());
}
}
}

View File

@ -25,5 +25,5 @@ public class WorkerSettledRequest {
private List<WorkerGoodsCategory> goodsCategories;
// 特殊技能
private List<WorkerSpecialSkill> specialSkills;
// private List<WorkerSpecialSkill> specialSkills;
}

View File

@ -0,0 +1,29 @@
package com.ghy.common.enums;
/**
* 师傅状态
*
* @author ydq
* @date : 2022-06-17 15:32
*/
public enum WorkerCertifyStatus {
AUDITING(0l, "审核中"),
AUDITOK(1l, "审核通过"),
AUDITFAILED(2l, "审核未通过");
private final Long code;
private final String desc;
WorkerCertifyStatus(Long code, String desc) {
this.code = code;
this.desc = desc;
}
public Long getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@ -73,4 +73,6 @@ public class OrderMaster extends BaseEntity {
private Long countryId;
private Integer exceptOrderStatus;
}

View File

@ -110,6 +110,9 @@
<if test="countryId != null">
AND ca.country_id = #{countryId}
</if>
<if test="exceptOrderStatus != null">
AND om.order_status != #{exceptOrderStatus}
</if>
</where>
order by om.create_time
<trim suffixOverrides=",">

View File

@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
import java.util.List;
/**
* 师傅实名审核对象 worker_certification
*
@ -20,7 +22,7 @@ public class WorkerCertification extends BaseEntity
/** 师傅者id */
@Excel(name = "师傅者id")
private String workerId;
private Long workerId;
/** 真实姓名 */
@Excel(name = "真实姓名")
@ -90,6 +92,12 @@ public class WorkerCertification extends BaseEntity
@Excel(name = "状态0审核中 1审核通过 2审核未通过")
private Long status;
// 特殊技能
private List<WorkerSpecialSkill> specialSkills;
// provincecitycountry三者的合并名称
private String mergerName;
public void setWorkerCertificationId(String workerCertificationId)
{
this.workerCertificationId = workerCertificationId;
@ -99,12 +107,12 @@ public class WorkerCertification extends BaseEntity
{
return workerCertificationId;
}
public void setWorkerId(String workerId)
public void setWorkerId(Long workerId)
{
this.workerId = workerId;
}
public String getWorkerId()
public Long getWorkerId()
{
return workerId;
}
@ -262,6 +270,22 @@ public class WorkerCertification extends BaseEntity
return status;
}
public List<WorkerSpecialSkill> getSpecialSkills() {
return specialSkills;
}
public void setSpecialSkills(List<WorkerSpecialSkill> specialSkills) {
this.specialSkills = specialSkills;
}
public String getMergerName() {
return mergerName;
}
public void setMergerName(String mergerName) {
this.mergerName = mergerName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -58,4 +58,18 @@ public interface WorkerCertificationMapper
* @return 结果
*/
public int deleteWorkerCertificationByWorkerCertificationIds(String[] workerCertificationIds);
/**
* 用师傅ID查询
*
* @param workerId 师傅ID
*/
WorkerCertification selectByWorkerId(Long workerId);
/**
* 通过师傅id删除实名记录
*
* @param workerId 师傅ID
*/
int deleteCertificationByWorkerId(Long workerId);
}

View File

@ -58,4 +58,20 @@ public interface IWorkerCertificationService
* @return 结果
*/
public int deleteWorkerCertificationByWorkerCertificationId(String workerCertificationId);
/**
* 查询师傅实名审核信息
*
* @param workerId 师傅id
* @return 师傅实名审核信息
*/
WorkerCertification selectByWorkerId(Long workerId);
/**
* 通过师傅id删除师傅实名审核信息
*
* @param workerId 师傅id
* @return 结果
*/
int deleteCertificationByWorkerId(Long workerId);
}

View File

@ -2,13 +2,14 @@ package com.ghy.worker.service.impl;
import java.util.List;
import com.ghy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ghy.worker.mapper.WorkerCertificationMapper;
import com.ghy.worker.domain.WorkerCertification;
import com.ghy.worker.service.IWorkerCertificationService;
import com.ghy.common.core.text.Convert;
import javax.annotation.Resource;
/**
* 师傅实名审核Service业务层处理
*
@ -18,7 +19,7 @@ import com.ghy.common.core.text.Convert;
@Service
public class WorkerCertificationServiceImpl implements IWorkerCertificationService
{
@Autowired
@Resource
private WorkerCertificationMapper workerCertificationMapper;
/**
@ -94,4 +95,14 @@ public class WorkerCertificationServiceImpl implements IWorkerCertificationServi
{
return workerCertificationMapper.deleteWorkerCertificationByWorkerCertificationId(workerCertificationId);
}
@Override
public WorkerCertification selectByWorkerId(Long workerId) {
return workerCertificationMapper.selectByWorkerId(workerId);
}
@Override
public int deleteCertificationByWorkerId(Long workerId) {
return workerCertificationMapper.deleteCertificationByWorkerId(workerId);
}
}

View File

@ -64,6 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where worker_certification_id = #{workerCertificationId}
</select>
<select id="selectByWorkerId" parameterType="Long" resultMap="WorkerCertificationResult">
<include refid="selectWorkerCertificationVo" /> WHERE worker_id = #{workerId}
</select>
<insert id="insertWorkerCertification" parameterType="WorkerCertification" useGeneratedKeys="true" keyProperty="workerCertificationId">
insert into worker_certification
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -159,4 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<delete id="deleteCertificationByWorkerId" parameterType="Long">
DELETE FROM worker_certification WHERE worker_id = #{workerId}
</delete>
</mapper>