|
@@ -8,12 +8,16 @@ import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
import com.ruoyi.project.system.domain.SysUser;
|
|
|
import com.ruoyi.project.system.service.ISysUserService;
|
|
|
-import com.ruoyi.project.training.bccnew.domain.*;
|
|
|
+import com.ruoyi.project.training.bccnew.domain.TTsLjplan;
|
|
|
+import com.ruoyi.project.training.bccnew.domain.TTsLjplanContent;
|
|
|
+import com.ruoyi.project.training.bccnew.domain.TTsNew;
|
|
|
import com.ruoyi.project.training.bccnew.service.*;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -44,7 +48,58 @@ public class TTsLjplanController extends BaseController {
|
|
|
* 查询裂解培训列表
|
|
|
*/
|
|
|
@GetMapping("/list")
|
|
|
- public AjaxResult list(TTsLjplan tTsLjplan) {
|
|
|
+ public TableDataInfo list(TTsLjplan tTsLjplan) {
|
|
|
+ List<TTsLjplan> list = new ArrayList<>();
|
|
|
+ List<TTsLjplan> tTsLjplans = tTsLjplanService.selectTTsLjplanList(tTsLjplan);
|
|
|
+ StringBuilder content = null;//内容
|
|
|
+ StringBuilder planDate = null;//计划培训时间
|
|
|
+ TTsLjplan entity = null;
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ for (int i = 0; i < tTsLjplans.size(); i++) {
|
|
|
+ TTsLjplan item = tTsLjplans.get(i);
|
|
|
+ if (i == 0) { // 第一条数据
|
|
|
+ entity = item;
|
|
|
+ content = new StringBuilder();
|
|
|
+ planDate = new StringBuilder();
|
|
|
+ if (item.getPlanDate() != null)
|
|
|
+ planDate.append(format.format(item.getPlanDate()));
|
|
|
+ content.append(item.getCourseDay()).append(":").append(item.getContent()).append(";"); //拼接内容字段 培训计划:内容;
|
|
|
+ } else {
|
|
|
+ if (entity.getTopic().equals(item.getTopic())) { // 判断当前对象的主题是否为当前返回对象的主题
|
|
|
+ content.append(item.getCourseDay()).append(":").append(item.getContent()).append(";");
|
|
|
+ } else {
|
|
|
+ if (tTsLjplans.get(i - 1).getPlanDate() != null)
|
|
|
+ planDate.append(" ~ ").append(format.format(tTsLjplans.get(i - 1).getPlanDate())); // 拼接截止日期
|
|
|
+ entity.setContent(content.toString());// 设置返回对象内容
|
|
|
+ entity.setPlanStartData(planDate.toString());// 设置返回对象计划培训时间
|
|
|
+ list.add(entity);
|
|
|
+ entity=item; // 修改新主题对象
|
|
|
+ content = new StringBuilder();
|
|
|
+ planDate = new StringBuilder();
|
|
|
+ if (item.getPlanDate() != null)
|
|
|
+ planDate.append(format.format(item.getPlanDate()));
|
|
|
+ content.append(item.getCourseDay()).append(":").append(item.getContent()).append(";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (i + 1 == tTsLjplans.size()) { // 最后一条
|
|
|
+ if (item.getPlanDate() != null)
|
|
|
+ planDate.append(" ~ ").append(format.format(item.getPlanDate()));
|
|
|
+ entity.setContent(content.toString());
|
|
|
+ entity.setPlanStartData(planDate.toString());
|
|
|
+ list.add(entity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ startPage();
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询分离培训列表
|
|
|
+ */
|
|
|
+ @GetMapping("/listAll")
|
|
|
+ public AjaxResult listAll(TTsLjplan tTsLjplan) {
|
|
|
return AjaxResult.success(tTsLjplanService.selectTTsLjplanList(tTsLjplan));
|
|
|
}
|
|
|
|
|
@@ -74,7 +129,7 @@ public class TTsLjplanController extends BaseController {
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody TTsLjplan tTsLjplan) {
|
|
|
int i = tTsLjplanService.insertTTsLjplan(tTsLjplan);
|
|
|
- if (CollectionUtils.isNotEmpty(tTsLjplan.getContents())){
|
|
|
+ if (CollectionUtils.isNotEmpty(tTsLjplan.getContents())) {
|
|
|
for (TTsLjplanContent content : tTsLjplan.getContents()) {
|
|
|
content.setPid(tTsLjplan.getId());
|
|
|
tTsLjplanContentService.insertTTsLjplanContent(content);
|
|
@@ -115,12 +170,12 @@ public class TTsLjplanController extends BaseController {
|
|
|
@Log(title = "裂解培训", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody TTsLjplan tTsLjplan) {
|
|
|
- if (CollectionUtils.isNotEmpty(tTsLjplan.getContents())){
|
|
|
+ if (CollectionUtils.isNotEmpty(tTsLjplan.getContents())) {
|
|
|
for (TTsLjplanContent content : tTsLjplan.getContents()) {
|
|
|
- if (content.getId()==null) {
|
|
|
+ if (content.getId() == null) {
|
|
|
content.setPid(tTsLjplan.getId());
|
|
|
tTsLjplanContentService.insertTTsLjplanContent(content);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
tTsLjplanContentService.updateTTsLjplanContent(content);
|
|
|
}
|
|
|
}
|
|
@@ -137,6 +192,9 @@ public class TTsLjplanController extends BaseController {
|
|
|
if ("满意".equals(tTsLjplan.getScore1()) && "差".equals(tTsLjplan.getScore2()) && "好".equals(tTsLjplan.getScore2())) {
|
|
|
tTsLjplan.setPlanStatus(5L);
|
|
|
}
|
|
|
+ if ("满意".equals(tTsLjplan.getScore1()) && "满意".equals(tTsLjplan.getScore2()) && "差".equals(tTsLjplan.getScore3())) {
|
|
|
+ tTsLjplan.setPlanStatus(4L);
|
|
|
+ }
|
|
|
if ("差".equals(tTsLjplan.getScore1()) && "好".equals(tTsLjplan.getScore2())) {
|
|
|
tTsLjplan.setPlanStatus(5L);
|
|
|
}
|
|
@@ -147,19 +205,21 @@ public class TTsLjplanController extends BaseController {
|
|
|
tTsLjplan.setPlanStatus(4L);
|
|
|
}
|
|
|
tTsLjplanService.updateTTsLjplan(tTsLjplan);
|
|
|
- if (tTsLjplan.getPlanStatus() == 5) {
|
|
|
- TTsNew tTsNew = new TTsNew();
|
|
|
- tTsNew.setPlanStatus(5L);
|
|
|
- tTsNew.setNewId(tTsLjplan.getNewId());
|
|
|
- tTsNew.setPlanType(1L);
|
|
|
- tTsNewService.updateTTsNew(tTsNew, getUserId(), getNickName());
|
|
|
-
|
|
|
- } else if (tTsLjplan.getPlanStatus() == 4) {
|
|
|
- TTsNew tTsNew = new TTsNew();
|
|
|
- tTsNew.setPlanStatus(4L);
|
|
|
- tTsNew.setNewId(tTsLjplan.getNewId());
|
|
|
- tTsNew.setPlanType(1L);
|
|
|
- tTsNewService.updateTTsNew(tTsNew, getUserId(), getNickName());
|
|
|
+ if (tTsLjplan.getPlanStatus() != null) {
|
|
|
+ if (tTsLjplan.getPlanStatus() == 5) {
|
|
|
+ TTsNew tTsNew = new TTsNew();
|
|
|
+ tTsNew.setPlanStatus(5L);
|
|
|
+ tTsNew.setNewId(tTsLjplan.getNewId());
|
|
|
+ tTsNew.setPlanType(1L);
|
|
|
+ tTsNewService.updateTTsNew(tTsNew, getUserId(), getNickName());
|
|
|
+
|
|
|
+ } else if (tTsLjplan.getPlanStatus() == 4) {
|
|
|
+ TTsNew tTsNew = new TTsNew();
|
|
|
+ tTsNew.setPlanStatus(4L);
|
|
|
+ tTsNew.setNewId(tTsLjplan.getNewId());
|
|
|
+ tTsNew.setPlanType(1L);
|
|
|
+ tTsNewService.updateTTsNew(tTsNew, getUserId(), getNickName());
|
|
|
+ }
|
|
|
}
|
|
|
return toAjax(1);
|
|
|
}
|