mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 15:01:23 +08:00
workVue update2
This commit is contained in:
@@ -12,6 +12,7 @@ import com.cfive.pinnacle.service.IUserWorkService;
|
|||||||
import com.cfive.pinnacle.service.IWorkService;
|
import com.cfive.pinnacle.service.IWorkService;
|
||||||
import com.cfive.pinnacle.service.impl.UserWorkServiceImpl;
|
import com.cfive.pinnacle.service.impl.UserWorkServiceImpl;
|
||||||
import com.cfive.pinnacle.service.impl.WorkServiceImpl;
|
import com.cfive.pinnacle.service.impl.WorkServiceImpl;
|
||||||
|
import com.cfive.pinnacle.utils.WebUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -33,21 +34,21 @@ import java.util.List;
|
|||||||
public class WorkController {
|
public class WorkController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IWorkService workService;
|
private IWorkService workService;
|
||||||
@Autowired
|
|
||||||
private IUserWorkService userWorkService;
|
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public ResponseResult getAll() {
|
public ResponseResult getAll() {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getAll());
|
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/todo/{userId}")
|
@GetMapping("/todo")
|
||||||
public ResponseResult getTodo(@PathVariable Long userId) {
|
public ResponseResult getTodo() {
|
||||||
|
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||||
|
System.out.println(userId);
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getTodo(userId));
|
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getTodo(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/complete/{userId}")
|
@GetMapping("/complete")
|
||||||
public ResponseResult getComplete(@PathVariable Long userId) {
|
public ResponseResult getComplete() {
|
||||||
|
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getComplete(userId));
|
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getComplete(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@ public class WorkController {
|
|||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResponseResult addWork(@RequestBody Work work) {
|
public ResponseResult addWork(@RequestBody Work work) {
|
||||||
|
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", workService.addWork(work));
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", workService.addWork(work));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,11 +72,13 @@ public class WorkController {
|
|||||||
@PutMapping("/setStatus")
|
@PutMapping("/setStatus")
|
||||||
public ResponseResult updateStatus(@RequestBody UserWork userWork) {
|
public ResponseResult updateStatus(@RequestBody UserWork userWork) {
|
||||||
System.out.println(userWork);
|
System.out.println(userWork);
|
||||||
|
userWork.setUserId(WebUtil.getLoginUser().getUser().getId());
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", workService.updateStatus(userWork));
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", workService.updateStatus(userWork));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public ResponseResult updateWork(@RequestBody Work work) {
|
public ResponseResult updateWork(@RequestBody Work work) {
|
||||||
|
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", workService.updateWork(work));
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", workService.updateWork(work));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,6 +77,7 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
|||||||
double completeNum = userWorkMapper.selectCount(new QueryWrapper<UserWork>().eq("work_id",workId).eq("status",1));
|
double completeNum = userWorkMapper.selectCount(new QueryWrapper<UserWork>().eq("work_id",workId).eq("status",1));
|
||||||
double progress = 0;
|
double progress = 0;
|
||||||
progress = (completeNum / workNum) * 100;
|
progress = (completeNum / workNum) * 100;
|
||||||
|
progress = (double) Math.round(progress * 100) / 100;
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ export default {
|
|||||||
todoConfirmEvent(row) {
|
todoConfirmEvent(row) {
|
||||||
const userWork = {
|
const userWork = {
|
||||||
workId: '',
|
workId: '',
|
||||||
userId: '1652714496280469506',
|
|
||||||
status: 1
|
status: 1
|
||||||
}
|
}
|
||||||
userWork.workId = row.id
|
userWork.workId = row.id
|
||||||
@@ -76,7 +75,7 @@ export default {
|
|||||||
},
|
},
|
||||||
getTableData() {
|
getTableData() {
|
||||||
request
|
request
|
||||||
.get('/work/complete/1652714496280469506')
|
.get('/work/complete')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.tableData = response.data.data
|
this.tableData = response.data.data
|
||||||
if (this.tableData) {
|
if (this.tableData) {
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ export default {
|
|||||||
completeConfirmEvent(row) {
|
completeConfirmEvent(row) {
|
||||||
const userWork = {
|
const userWork = {
|
||||||
workId: '',
|
workId: '',
|
||||||
userId: '1652714496280469506',
|
|
||||||
status: 0
|
status: 0
|
||||||
}
|
}
|
||||||
userWork.workId = row.id
|
userWork.workId = row.id
|
||||||
@@ -75,7 +74,7 @@ export default {
|
|||||||
},
|
},
|
||||||
getTableData() {
|
getTableData() {
|
||||||
request
|
request
|
||||||
.get('/work/todo/1652714496280469506')
|
.get('/work/todo')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.tableData = response.data.data
|
this.tableData = response.data.data
|
||||||
if (this.taskData) {
|
if (this.taskData) {
|
||||||
|
|||||||
Reference in New Issue
Block a user