修改内容审核逻辑---以最后一个人的意见为准。

This commit is contained in:
haotianmingyue 2024-12-12 14:15:45 +08:00
parent cdafef1d4d
commit 74a6f1cbfa
8 changed files with 495 additions and 206 deletions

View File

@ -0,0 +1,51 @@
package com.ruoyi.web.controller.backstage;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysSource;
import com.ruoyi.system.domain.dto.SourceListDto;
import com.ruoyi.system.service.ISysSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.List;
// 产品管理后台
@RestController
@RequestMapping("/system/source")
public class SysSourceController extends BaseController {
@Autowired
private ISysSourceService sysSourceService;
// 获取系统资源位列表, 附带搜索功能
@GetMapping("/getAllSource")
public TableDataInfo getAllSource(SysSource sysSource) {
startPage();
List<SourceListDto> sysSourceList = sysSourceService.getSysSourceList(sysSource);
for(SourceListDto sourceListDto : sysSourceList){
LocalDate startTime = sourceListDto.getStartTime();
LocalDate endTime = sourceListDto.getEndTime();
sourceListDto.setTime(sourceListDto.getStartTime() + "~" + sourceListDto.getEndTime());
long daysBetween = ChronoUnit.DAYS.between(startTime, endTime);
// 展示天数
sourceListDto.setpDay(daysBetween);
}
return getDataTable(sysSourceList);
}
}

View File

@ -174,6 +174,8 @@ public class SysWorkReviewController extends BaseController {
// 审核作品
// 待更新退款相关逻辑!!
// 默认没有第4个人审核---------如果有的话需要修改相关逻辑
// 审核完成后---------发送消息通知
// 20241212---------审核以最后一个人的审核标准为准.----------------
@Log(title = "内容审核--审核作品", businessType = BusinessType.UPDATE)
@Transactional
@PostMapping("/reviewWork")
@ -214,121 +216,154 @@ public class SysWorkReviewController extends BaseController {
}
//------------------------------新建审核意见结束------------------------------------
//----------------------------------作品---------------
// 这里默认一定能查到, 不然怎么审核这个作品
//-----------------------------新版审核逻辑-能无数个人审-以最后一个人审的为准---------------------
UserWork userWork = userWorkService.selectUserWorkByWorkId(workId);
//-----------------------------修改作品状态-----------------------------------------
// 要判断这是第几个审核人了, 若是第三个人就要参考作品状态来决定是否通过
// 查看当前作品审核人总数
List<WorkReview> workReviewList = workReviewService.selectWorkReviewList(workReview);
if (workReviewList.size()==3){
// 如果size=3,则以第三个人的判断为准
// 第三个人审核通过
if (workStatus.equals("3")){
// 设置作品状态为审核通过
userWork.setWorkStatus("3");
// 设置评审意见
userWork.setAuditOpinion(userWork.getAuditOpinion()+auditOpinion);
// 更新作品数据库
int backUpdate = userWorkService.updateUserWork(userWork);
if(backUpdate==0){
return error("更新作品状态失败");
}
return success("作品审核完成");
}else if (workStatus.equals("4")){ // 第三个人审核不通过---可能触发退款
// 设置作品状态为审核不通过
userWork.setWorkStatus("4");
// 设置评审意见
userWork.setAuditOpinion(userWork.getAuditOpinion()+auditOpinion);
//-------------------------退款检测-----------------------------------------
//-------------------------退款检测-----------------------------------------
// 更新作品数据库
int backUpdate = userWorkService.updateUserWork(userWork);
if(backUpdate==0){
return error("更新作品状态失败");
}
return success("作品审核完成");
}
}
// 两个人的判断一致时,修改状态.
else if(workReviewList.size()==2){
if (workReviewList.get(0).getWorkStatus().equals(workReviewList.get(1).getWorkStatus())){
// 两个人判断一致
// 审核不通过
if(workReviewList.get(0).getWorkStatus().equals("4")){
userWork.setWorkStatus("5");
// 退款逻辑
}
else{
// 设置作品状态为两人相同的状态, 两人都通过
userWork.setWorkStatus("3");
}
// 设置评审意见
userWork.setAuditOpinion(userWork.getAuditOpinion()+","+nickName+"审核: "+auditOpinion);
// 更新作品数据库
int backUpdate = userWorkService.updateUserWork(userWork);
if(backUpdate==0){
return error("更新作品状态失败");
}
// 审核不通过
if(workStatus.equals("4")){
//退款逻辑--------判断时间-----
return success("作品审核完成");
}
// 两人意见不同, 就不更新待审核状态, 只保存意见
else{
// 设置评审意见--------只更新评审意见就行
userWork.setAuditOpinion(userWork.getAuditOpinion()+nickName+"审核: "+auditOpinion);
// 更新作品数据库
int backUpdate = userWorkService.updateUserWork(userWork);
if(backUpdate==0){
return error("更新作品状态失败");
}
return success("作品审核完成");
}
//消息提醒-------------
}
else{ // 第一个人评论
// 设置评审意见--------只更新评审意见就行
userWork.setAuditOpinion(userWork.getAuditOpinion()+nickName+"审核: "+auditOpinion);
// 更新作品数据库
int backUpdate = userWorkService.updateUserWork(userWork);
if(backUpdate==0){
return error("更新作品状态失败");
}
userWork.setWorkStatus(workStatus);
return success("作品审核完成");
userWork.setAuditOpinion(userWork.getAuditOpinion()+auditOpinion);
//更新作品数据库
int backUpdate = userWorkService.updateUserWork(userWork);
if(backUpdate==0){
return error("更新作品状态失败");
}
return success("作品审核完成");
//--------------------------------新版审核逻辑结束--------------------------------------
// //----------------------------------旧版作品审核---以多人的意见为准---------------
// // 这里默认一定能查到, 不然怎么审核这个作品
// UserWork userWork = userWorkService.selectUserWorkByWorkId(workId);
//
//
//
// //-----------------------------修改作品状态-----------------------------------------
// // 要判断这是第几个审核人了, 若是第三个人就要参考作品状态来决定是否通过
// // 查看当前作品审核人总数
// List<WorkReview> workReviewList = workReviewService.selectWorkReviewList(workReview);
//
// if (workReviewList.size()==3){
// // 如果size=3,则以第三个人的判断为准
//
// // 第三个人审核通过
// if (workStatus.equals("3")){
//
//
// // 设置作品状态为审核通过
// userWork.setWorkStatus("3");
// // 设置评审意见
// userWork.setAuditOpinion(userWork.getAuditOpinion()+auditOpinion);
//
// // 更新作品数据库
// int backUpdate = userWorkService.updateUserWork(userWork);
// if(backUpdate==0){
// return error("更新作品状态失败");
// }
//
//
// return success("作品审核完成");
//
//
// }else if (workStatus.equals("4")){ // 第三个人审核不通过---可能触发退款
// // 设置作品状态为审核不通过
// userWork.setWorkStatus("4");
// // 设置评审意见
// userWork.setAuditOpinion(userWork.getAuditOpinion()+auditOpinion);
//
// //-------------------------退款检测-----------------------------------------
//
// //-------------------------退款检测-----------------------------------------
//
// // 更新作品数据库
// int backUpdate = userWorkService.updateUserWork(userWork);
// if(backUpdate==0){
// return error("更新作品状态失败");
// }
//
// return success("作品审核完成");
// }
//
//
// }
// // 两个人的判断一致时,修改状态.
// else if(workReviewList.size()==2){
// if (workReviewList.get(0).getWorkStatus().equals(workReviewList.get(1).getWorkStatus())){
// // 两个人判断一致
//
//
// // 审核不通过
// if(workReviewList.get(0).getWorkStatus().equals("4")){
// userWork.setWorkStatus("5");
//
// // 退款逻辑
// }
// else{
// // 设置作品状态为两人相同的状态, 两人都通过
// userWork.setWorkStatus("3");
// }
//
// // 设置评审意见
// userWork.setAuditOpinion(userWork.getAuditOpinion()+","+nickName+"审核: "+auditOpinion);
//
// // 更新作品数据库
// int backUpdate = userWorkService.updateUserWork(userWork);
// if(backUpdate==0){
// return error("更新作品状态失败");
// }
//
//
//
// return success("作品审核完成");
//
// }
// // 两人意见不同, 就不更新待审核状态, 只保存意见
// else{
// // 设置评审意见--------只更新评审意见就行
// userWork.setAuditOpinion(userWork.getAuditOpinion()+nickName+"审核: "+auditOpinion);
// // 更新作品数据库
// int backUpdate = userWorkService.updateUserWork(userWork);
// if(backUpdate==0){
// return error("更新作品状态失败");
// }
//
// return success("作品审核完成");
// }
// }
//
// else{ // 第一个人评论
// // 设置评审意见--------只更新评审意见就行
// userWork.setAuditOpinion(userWork.getAuditOpinion()+nickName+"审核: "+auditOpinion);
// // 更新作品数据库
// int backUpdate = userWorkService.updateUserWork(userWork);
// if(backUpdate==0){
// return error("更新作品状态失败");
// }
//
// return success("作品审核完成");
// }
//
// return success("作品审核完成");
//
// //--------------------旧版审核------------------------------------------------------------------
//-----------------------------修改作品状态结束-------------------------------------

View File

@ -1,104 +1,104 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysSource;
import com.ruoyi.system.service.ISysSourceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 资源位Controller
*
* @author ruoyi
* @date 2024-11-08
*/
@RestController
@RequestMapping("/system/source")
public class SysSourceController extends BaseController
{
@Autowired
private ISysSourceService sysSourceService;
/**
* 查询资源位列表
*/
@PreAuthorize("@ss.hasPermi('system:source:list')")
@GetMapping("/list")
public TableDataInfo list(SysSource sysSource)
{
startPage();
List<SysSource> list = sysSourceService.selectSysSourceList(sysSource);
return getDataTable(list);
}
/**
* 导出资源位列表
*/
@PreAuthorize("@ss.hasPermi('system:source:export')")
@Log(title = "资源位", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysSource sysSource)
{
List<SysSource> list = sysSourceService.selectSysSourceList(sysSource);
ExcelUtil<SysSource> util = new ExcelUtil<SysSource>(SysSource.class);
util.exportExcel(response, list, "资源位数据");
}
/**
* 获取资源位详细信息
*/
@PreAuthorize("@ss.hasPermi('system:source:query')")
@GetMapping(value = "/{sourceId}")
public AjaxResult getInfo(@PathVariable("sourceId") Long sourceId)
{
return success(sysSourceService.selectSysSourceBySourceId(sourceId));
}
/**
* 新增资源位
*/
@PreAuthorize("@ss.hasPermi('system:source:add')")
@Log(title = "资源位", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysSource sysSource)
{
return toAjax(sysSourceService.insertSysSource(sysSource));
}
/**
* 修改资源位
*/
@PreAuthorize("@ss.hasPermi('system:source:edit')")
@Log(title = "资源位", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysSource sysSource)
{
return toAjax(sysSourceService.updateSysSource(sysSource));
}
/**
* 删除资源位
*/
@PreAuthorize("@ss.hasPermi('system:source:remove')")
@Log(title = "资源位", businessType = BusinessType.DELETE)
@DeleteMapping("/{sourceIds}")
public AjaxResult remove(@PathVariable Long[] sourceIds)
{
return toAjax(sysSourceService.deleteSysSourceBySourceIds(sourceIds));
}
}
//package com.ruoyi.system.controller;
//
//import java.util.List;
//import javax.servlet.http.HttpServletResponse;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.ruoyi.common.annotation.Log;
//import com.ruoyi.common.core.controller.BaseController;
//import com.ruoyi.common.core.domain.AjaxResult;
//import com.ruoyi.common.enums.BusinessType;
//import com.ruoyi.system.domain.SysSource;
//import com.ruoyi.system.service.ISysSourceService;
//import com.ruoyi.common.utils.poi.ExcelUtil;
//import com.ruoyi.common.core.page.TableDataInfo;
//
///**
// * 资源位Controller
// *
// * @author ruoyi
// * @date 2024-11-08
// */
//@RestController
//@RequestMapping("/system/source")
//public class SysSourceController extends BaseController
//{
// @Autowired
// private ISysSourceService sysSourceService;
//
// /**
// * 查询资源位列表
// */
// @PreAuthorize("@ss.hasPermi('system:source:list')")
// @GetMapping("/list")
// public TableDataInfo list(SysSource sysSource)
// {
// startPage();
// List<SysSource> list = sysSourceService.selectSysSourceList(sysSource);
// return getDataTable(list);
// }
//
// /**
// * 导出资源位列表
// */
// @PreAuthorize("@ss.hasPermi('system:source:export')")
// @Log(title = "资源位", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, SysSource sysSource)
// {
// List<SysSource> list = sysSourceService.selectSysSourceList(sysSource);
// ExcelUtil<SysSource> util = new ExcelUtil<SysSource>(SysSource.class);
// util.exportExcel(response, list, "资源位数据");
// }
//
// /**
// * 获取资源位详细信息
// */
// @PreAuthorize("@ss.hasPermi('system:source:query')")
// @GetMapping(value = "/{sourceId}")
// public AjaxResult getInfo(@PathVariable("sourceId") Long sourceId)
// {
// return success(sysSourceService.selectSysSourceBySourceId(sourceId));
// }
//
// /**
// * 新增资源位
// */
// @PreAuthorize("@ss.hasPermi('system:source:add')")
// @Log(title = "资源位", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody SysSource sysSource)
// {
// return toAjax(sysSourceService.insertSysSource(sysSource));
// }
//
// /**
// * 修改资源位
// */
// @PreAuthorize("@ss.hasPermi('system:source:edit')")
// @Log(title = "资源位", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody SysSource sysSource)
// {
// return toAjax(sysSourceService.updateSysSource(sysSource));
// }
//
// /**
// * 删除资源位
// */
// @PreAuthorize("@ss.hasPermi('system:source:remove')")
// @Log(title = "资源位", businessType = BusinessType.DELETE)
// @DeleteMapping("/{sourceIds}")
// public AjaxResult remove(@PathVariable Long[] sourceIds)
// {
// return toAjax(sysSourceService.deleteSysSourceBySourceIds(sourceIds));
// }
//}

View File

@ -0,0 +1,146 @@
package com.ruoyi.system.domain.dto;
import java.time.LocalDate;
public class SourceListDto {
private Long sourceId;
private String city;
private String scenic;
// 面积
private String scale;
private String part;
private String price;
private Long bBought;
private String sourceStatus;
private String workAddress;
// 展示天数
private Long pDay;
private LocalDate startTime;
private LocalDate endTime;
// 期限
private String time;
// 剩余天数
private Long rDay;
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getScenic() {
return scenic;
}
public void setScenic(String scenic) {
this.scenic = scenic;
}
public String getPart() {
return part;
}
public void setPart(String part) {
this.part = part;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public Long getbBought() {
return bBought;
}
public void setbBought(Long bBought) {
this.bBought = bBought;
}
public String getSourceStatus() {
return sourceStatus;
}
public void setSourceStatus(String sourceStatus) {
this.sourceStatus = sourceStatus;
}
public String getWorkAddress() {
return workAddress;
}
public void setWorkAddress(String workAddress) {
this.workAddress = workAddress;
}
public Long getpDay() {
return pDay;
}
public void setpDay(Long pDay) {
this.pDay = pDay;
}
public LocalDate getStartTime() {
return startTime;
}
public void setStartTime(LocalDate startTime) {
this.startTime = startTime;
}
public LocalDate getEndTime() {
return endTime;
}
public void setEndTime(LocalDate endTime) {
this.endTime = endTime;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public Long getrDay() {
return rDay;
}
public void setrDay(Long rDay) {
this.rDay = rDay;
}
public String getScale() {
return scale;
}
public void setScale(String scale) {
this.scale = scale;
}
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysSource;
import com.ruoyi.system.domain.dto.SourceListDto;
import com.ruoyi.system.domain.dto.SourcePriceDto;
import org.apache.ibatis.annotations.Param;
@ -67,4 +68,6 @@ public interface SysSourceMapper
* @return 结果
*/
public int deleteSysSourceBySourceIds(Long[] sourceIds);
public List<SourceListDto> getSysSourceList(SysSource sysSource);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysSource;
import com.ruoyi.system.domain.dto.ChangeSourcePriceDto;
import com.ruoyi.system.domain.dto.SourceListDto;
import com.ruoyi.system.domain.dto.SourcePriceDto;
/**
@ -71,4 +72,10 @@ public interface ISysSourceService
* @return 结果
*/
public int deleteSysSourceBySourceId(Long sourceId);
/*
* 后台获取资源位信息列表
* */
public List<SourceListDto> getSysSourceList(SysSource sysSource);
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.system.domain.dto.SourceListDto;
import com.ruoyi.system.domain.dto.SourcePriceDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -104,4 +105,9 @@ public class SysSourceServiceImpl implements ISysSourceService
{
return sysSourceMapper.deleteSysSourceBySourceId(sourceId);
}
@Override
public List<SourceListDto> getSysSourceList(SysSource sysSource){
return sysSourceMapper.getSysSourceList(sysSource);
}
}

View File

@ -22,6 +22,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" />
</resultMap>
<resultMap id="SourceListDtoResult" type="SourceListDto">
<result property="sourceId" column="source_id" />
<result property="city" column="city" />
<result property="scenic" column="scenic" />
<result property="part" column="part" />
<result property="scale" column="scale" />
<result property="price" column="price" />
<result property="sourceStatus" column="source_status" />
<result property="workAddress" column="work_address" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="bBought" column="b_bought" />
</resultMap>
<sql id="selectSysSourceVo">
select source_id, city_id, city, scenic_id, scenic, part, scale, coordinate, price, source_status, work_address, start_time, end_time, b_bought, order_id from sys_source
</sql>
@ -50,7 +67,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysSourceVo"/>
where source_id = #{sourceId}
</select>
<select id="getSysSourceList" resultMap="SourceListDtoResult" parameterType="SysSource">
select s.source_id, s.city, s.scenic, s.part, s.scale, s.price, s.source_status, s.work_address, o.start_time, o.end_time, s.b_bought
from sys_source s
left join sys_order o
on s.order_id = o.order_id
<where>
<if test="cityId != null "> and city_id = #{cityId}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="scenicId != null "> and scenic_id = #{scenicId}</if>
<if test="scenic != null and scenic != ''"> and scenic = #{scenic}</if>
<if test="part != null and part != ''"> and part = #{part}</if>
<if test="scale != null and scale != ''"> and scale = #{scale}</if>
<if test="coordinate != null and coordinate != ''"> and coordinate = #{coordinate}</if>
<if test="price != null and price != ''"> and price = #{price}</if>
<if test="sourceStatus != null and sourceStatus != ''"> and source_status = #{sourceStatus}</if>
<if test="workAddress != null and workAddress != ''"> and work_address = #{workAddress}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="bBought != null "> and b_bought = #{bBought}</if>
<if test="orderId != null "> and order_id = #{orderId}</if>
</where>
</select>
<insert id="insertSysSource" parameterType="SysSource" useGeneratedKeys="true" keyProperty="sourceId">
insert into sys_source
<trim prefix="(" suffix=")" suffixOverrides=",">