|
@@ -171,24 +171,33 @@ public class RevenueController {
|
|
|
@ApiOperation(value = "修改营收数据")
|
|
|
public AjaxMessage<Integer> updateRevenue(
|
|
|
@ApiParam(value = "营收数据", required = true) @RequestBody MonthRevenueDto monthRevenueDto) {
|
|
|
- LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
- //修改营收数据
|
|
|
- monthRevenueDto.setUpdateBy(loginUser.getUsername());
|
|
|
- oneConvertWan(monthRevenueDto);
|
|
|
- revenueService.updateRevenue(monthRevenueDto);
|
|
|
- //修改售水数据
|
|
|
- for (MonthSellwaterEntity entity : monthRevenueDto.getMonthSellList()) {
|
|
|
- entity.setUpdateBy(loginUser.getUsername());
|
|
|
- if(entity.getWaterUsage() != null){
|
|
|
- entity.setWaterUsage(entity.getWaterUsage()/10000);
|
|
|
- }
|
|
|
- if(entity.getId() == null){
|
|
|
- revenueService.insertSellWater(entity);
|
|
|
- }else{
|
|
|
- revenueService.updateSellWater(entity);
|
|
|
+ try{
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ //修改营收数据
|
|
|
+ monthRevenueDto.setUpdateBy(loginUser.getUsername());
|
|
|
+ oneConvertWan(monthRevenueDto);
|
|
|
+ revenueService.updateRevenue(monthRevenueDto);
|
|
|
+ //修改售水数据
|
|
|
+ for (MonthSellwaterEntity entity : monthRevenueDto.getMonthSellList()) {
|
|
|
+ entity.setUpdateBy(loginUser.getUsername());
|
|
|
+ if(entity.getWaterUsage() != null){
|
|
|
+ entity.setWaterUsage(entity.getWaterUsage()/10000);
|
|
|
+ }
|
|
|
+ if(entity.getId() == null){
|
|
|
+ entity.setTenantId(loginUser.getTenantId());
|
|
|
+ entity.setCreateBy(loginUser.getUsername());
|
|
|
+ entity.setCompanyOrgId(monthRevenueDto.getCompanyOrgId());
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
+ entity.setCollectDate(sdf.parse(monthRevenueDto.getCollectDateString()));
|
|
|
+ revenueService.insertSellWater(entity);
|
|
|
+ }else{
|
|
|
+ revenueService.updateSellWater(entity);
|
|
|
+ }
|
|
|
}
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK);
|
|
|
+ }catch (Exception e){
|
|
|
+ return new AjaxMessage<>(ResultStatus.ERROR);
|
|
|
}
|
|
|
- return new AjaxMessage<>(ResultStatus.OK);
|
|
|
}
|
|
|
/**
|
|
|
* 将营收数据转换成万
|