|
@@ -17,23 +17,26 @@
|
|
|
package org.springblade.meter.controller;
|
|
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
-import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.meter.dto.StartPayMeterFormDTO;
|
|
|
+import org.springblade.meter.entity.MeterContractInfo;
|
|
|
+import org.springblade.meter.vo.StartPayMeterFormVO;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import org.springblade.meter.entity.StartPayMeterForm;
|
|
|
import org.springblade.meter.service.IStartPayMeterFormService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 开工预付款计量单 控制器
|
|
|
*
|
|
@@ -48,57 +51,70 @@ public class StartPayMeterFormController extends BladeController {
|
|
|
|
|
|
private final IStartPayMeterFormService startPayMeterFormService;
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
/**
|
|
|
- * 详情
|
|
|
+ * 开工预付款总额
|
|
|
*/
|
|
|
- @GetMapping("/detail")
|
|
|
+ @GetMapping("/getStartAmount")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
- @ApiOperation(value = "详情", notes = "传入startPayMeterForm")
|
|
|
- public R<StartPayMeterForm> detail(StartPayMeterForm startPayMeterForm) {
|
|
|
- StartPayMeterForm detail = startPayMeterFormService.getOne(Condition.getQueryWrapper(startPayMeterForm));
|
|
|
- return R.data(detail);
|
|
|
+ @ApiOperation(value = "开工预付款总额", notes = "传入contractId")
|
|
|
+ public R<BigDecimal> getStartAmount(Long contractId) {
|
|
|
+ List<MeterContractInfo> list = jdbcTemplate.queryForList("select dy_total_amount from s_meter_contract_info where contract_id = " + contractId, MeterContractInfo.class);
|
|
|
+ if (list.size() == 0){
|
|
|
+ return R.data(null);
|
|
|
+ }else {
|
|
|
+ return R.data(list.get(0).getDyTotalAmount());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * 分页 开工预付款计量单
|
|
|
+ * 新增 开工预付款计量单
|
|
|
*/
|
|
|
- @GetMapping("/list")
|
|
|
+ @PostMapping("/add")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
- @ApiOperation(value = "分页", notes = "传入startPayMeterForm")
|
|
|
- public R<IPage<StartPayMeterForm>> list(StartPayMeterForm startPayMeterForm, Query query) {
|
|
|
- IPage<StartPayMeterForm> pages = startPayMeterFormService.page(Condition.getPage(query), Condition.getQueryWrapper(startPayMeterForm));
|
|
|
- return R.data(pages);
|
|
|
+ @ApiOperation(value = "新增", notes = "传入startPayMeterFormDTO")
|
|
|
+ public R add(@Valid @RequestBody StartPayMeterFormDTO dto) {
|
|
|
+ startPayMeterFormService.add(dto);
|
|
|
+ return R.success("新增成功");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * 新增 开工预付款计量单
|
|
|
+ * 修改 开工预付款计量单
|
|
|
*/
|
|
|
- @PostMapping("/save")
|
|
|
- @ApiOperationSupport(order = 4)
|
|
|
- @ApiOperation(value = "新增", notes = "传入startPayMeterForm")
|
|
|
- public R save(@Valid @RequestBody StartPayMeterForm startPayMeterForm) {
|
|
|
- return R.status(startPayMeterFormService.save(startPayMeterForm));
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "修改", notes = "传入startPayMeterFormDTO")
|
|
|
+ public R update(@Valid @RequestBody StartPayMeterFormDTO dto) {
|
|
|
+ startPayMeterFormService.update2(dto);
|
|
|
+ return R.success("修改成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改 开工预付款计量单
|
|
|
+ * 分页 开工预付款计量单
|
|
|
*/
|
|
|
- @PostMapping("/update")
|
|
|
- @ApiOperationSupport(order = 5)
|
|
|
- @ApiOperation(value = "修改", notes = "传入startPayMeterForm")
|
|
|
- public R update(@Valid @RequestBody StartPayMeterForm startPayMeterForm) {
|
|
|
- return R.status(startPayMeterFormService.updateById(startPayMeterForm));
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入计量期id与合同id和分页信息,不传计量期id代表查询所有")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "meterPeriodId", value = "计量期id", required = false),
|
|
|
+ @ApiImplicitParam(name = "contractId", value = "合同id", required = true)
|
|
|
+ })
|
|
|
+ public R<IPage<StartPayMeterFormVO>> page(Long contractId, Long meterPeriodId, Query query) {
|
|
|
+ IPage<StartPayMeterFormVO> pages = startPayMeterFormService.page2(contractId,meterPeriodId,query);
|
|
|
+ return R.data(pages);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增或修改 开工预付款计量单
|
|
|
+ * 详情
|
|
|
*/
|
|
|
- @PostMapping("/submit")
|
|
|
- @ApiOperationSupport(order = 6)
|
|
|
- @ApiOperation(value = "新增或修改", notes = "传入startPayMeterForm")
|
|
|
- public R submit(@Valid @RequestBody StartPayMeterForm startPayMeterForm) {
|
|
|
- return R.status(startPayMeterFormService.saveOrUpdate(startPayMeterForm));
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入id")
|
|
|
+ public R<StartPayMeterFormVO> detail(Long id) {
|
|
|
+ StartPayMeterFormVO detail = startPayMeterFormService.detail(id);
|
|
|
+ return R.data(detail);
|
|
|
}
|
|
|
|
|
|
|