| | |
| | | import com.zzg.system.service.state.StateAssetService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | public class StateAssetController { |
| | | |
| | | private final StateAssetService assetService; |
| | | |
| | | // 新增和修改 项目资金 |
| | | @PostMapping(UrlConstants.STATE_PROJECT_ASSET_SAVE) |
| | | public AjaxResult<Boolean> saveAsset(@RequestBody StateAssetBO asset) { |
| | | return AjaxResult.success(assetService.saveAsset(asset)); |
| | | } |
| | | |
| | | // 项目删除 |
| | | @GetMapping(UrlConstants.STATE_PROJECT_ASSET_DEL) |
| | | public AjaxResult<Boolean> delAsset(@RequestParam String assetId) { |
| | | StateAsset asset = assetService.getById(assetId); |
| | | if (Objects.isNull(asset)) { |
| | | return AjaxResult.error(); |
| | | } |
| | | //TODO 审核状态为通过的也可以删除 逻辑删除 |
| | | LambdaUpdateWrapper<StateAsset> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(StateAsset::getId, asset.getId()); |
| | | updateWrapper.set(StateAsset::getDelFlag, DeleteFlagEnum.DELETED.getKey()); |
| | | return AjaxResult.success(assetService.update(updateWrapper)); |
| | | } |
| | | |
| | | // 项目资金展示 |
| | | @GetMapping(UrlConstants.STATE_PROJECT_ASSET_LIST) |
| | | public AjaxResult<List<StateAsset>> listAsset( |
| | | @RequestParam String projectId, |
| | |
| | | .setScale(4, RoundingMode.HALF_UP))); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | // 项目资金 上方统计数据 |
| | | @GetMapping(UrlConstants.STATE_PROJECT_ASSET_SUM) |
| | | public AjaxResult<JSONObject> sumAsset(@RequestParam String projectId) { |
| | | return AjaxResult.success(assetService.sumAsset(projectId)); |
| | | } |
| | | |
| | | // 项目资金点击上方符号查询 |
| | | @PostMapping(UrlConstants.STATE_PROJECT_ASSET_DETAIL) |
| | | public AjaxResult<PageInfo<StateAssetDetailVO>> listAssetDetail(@RequestBody AssetDetailBO detailBO) { |
| | | return AjaxResult.success(assetService.listAssetDetail(detailBO)); |