he2802 2 anos atrás
pai
commit
a5e4c2f9b1

+ 8 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/financial/TopCostTpController.java

@@ -89,4 +89,12 @@ public class TopCostTpController extends BaseController {
     }
 
 
+    @ApiOperation("修改成本模板默认状态")
+    @PreAuthorize("@ss.hasPermi('system:tp:edit')")
+    @Log(title = "成本模板", businessType = BusinessType.UPDATE)
+    @PostMapping("/editDefaultStatus")
+    public AjaxResult<Void> editDefaultStatus(@RequestBody TopCostTpEditBo bo) {
+        return toAjax(iTopCostTpService.updateDefaultStatus(bo) ? 1 : 0);
+    }
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/financial/bo/TopCostTpAddBo.java

@@ -32,4 +32,7 @@ public class TopCostTpAddBo {
     private Long updateTime;
     @ApiModelProperty("子项数组")
     private List<TopCostTpItemAddBo> itemList;
+    /** 默认选择状态 1选中 0非选中 */
+    @ApiModelProperty("默认选择状态 1选中 0非选中")
+    private Integer defaultStatus;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/financial/bo/TopCostTpEditBo.java

@@ -36,4 +36,7 @@ public class TopCostTpEditBo {
 
     @ApiModelProperty("子项数组")
     private List<TopCostTpItemAddBo> itemList;
+    /** 默认选择状态 1选中 0非选中 */
+    @ApiModelProperty("默认选择状态 1选中 0非选中")
+    private Integer defaultStatus;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/financial/domain/TopCostTp.java

@@ -36,4 +36,6 @@ private static final long serialVersionUID=1L;
     /** 修改时间 */
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Long updateTime;
+    /** 默认选择状态 1选中 0非选中 */
+    private Integer defaultStatus;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/financial/service/ITopCostTpService.java

@@ -49,4 +49,7 @@ public interface ITopCostTpService extends IService<TopCostTp> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+
+	Boolean updateDefaultStatus(TopCostTpEditBo bo);
 }

+ 22 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/financial/service/impl/TopCostTpServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.financial.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.course.bo.CourseChapterBusinessAddBo;
@@ -15,6 +16,7 @@ import com.zhongzheng.modules.financial.service.ITopCostTpItemService;
 import com.zhongzheng.modules.financial.service.ITopCostTpService;
 import com.zhongzheng.modules.financial.vo.TopCostTpItemVo;
 import com.zhongzheng.modules.financial.vo.TopCostTpVo;
+import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.sdk.domain.TopNuoMplatformLog;
 import com.zhongzheng.modules.sdk.service.NuonuoService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -142,4 +144,24 @@ public class TopCostTpServiceImpl extends ServiceImpl<TopCostTpMapper, TopCostTp
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean updateDefaultStatus(TopCostTpEditBo bo) {
+        TopCostTp update = new TopCostTp();
+        update.setTpId(bo.getTpId());
+        if(bo.getDefaultStatus()==1){
+            LambdaUpdateWrapper<TopCostTp> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+            objectLambdaUpdateWrapper.eq(TopCostTp::getTpId, bo.getTpId());
+            objectLambdaUpdateWrapper.set(TopCostTp::getDefaultStatus, 0);
+            objectLambdaUpdateWrapper.set(TopCostTp::getUpdateTime, DateUtils.getNowTime());
+            update(null, objectLambdaUpdateWrapper);
+            update.setDefaultStatus(1);
+        }
+        if(bo.getDefaultStatus()==0){
+            update.setDefaultStatus(0);
+        }
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
 }