mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增组织余额自动补充接口
This commit is contained in:
+10
@@ -14,9 +14,11 @@ import com.cf.imes.module.system.controller.admin.funds.organamount.vo.TotalAmou
|
||||
import com.cf.imes.module.system.service.funds.organamount.OrganAmountService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -85,4 +87,12 @@ public class OrganAmountController {
|
||||
public CommonResult<Map<String, Object>> getManageConsumptionTrend(@Valid OrganFundsStatisticsReqVO reqVO) {
|
||||
return success(organAmountService.getConsumptionTrend(reqVO, false));
|
||||
}
|
||||
|
||||
@PostMapping("/fix")
|
||||
@Operation(summary = "修正组织余额")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> fixOrganAmount() {
|
||||
organAmountService.fixOrganAmount();
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -82,4 +82,9 @@ public interface OrganAmountService {
|
||||
* @return
|
||||
*/
|
||||
PageResult<TotalAmountDetailsRespVO> getManageTotalAmountDetails(@Param("reqVO") TotalAmountDetailsPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 修正组织余额,遍历组织列表,补充system_organization_amount数据
|
||||
*/
|
||||
void fixOrganAmount();
|
||||
}
|
||||
|
||||
+20
@@ -24,6 +24,7 @@ import com.cf.imes.module.system.controller.admin.funds.organamount.vo.TotalAmou
|
||||
import com.cf.imes.module.system.dal.dataobject.incomeandexpense.IncomeExpenseDetailsDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
||||
import com.cf.imes.module.system.dal.mysql.incomeandexpense.IncomeExpenseDetailsMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.organ.OrganMapper;
|
||||
import com.cf.imes.module.system.enums.pay.TradeTypeEnum;
|
||||
import com.cf.imes.module.system.service.funds.invoice.InvoiceService;
|
||||
import com.cf.imes.module.system.service.funds.purchase.PurchaseService;
|
||||
@@ -79,6 +80,9 @@ public class OrganAmountServiceImpl implements OrganAmountService {
|
||||
@Resource
|
||||
private PurchaseService purchaseService;
|
||||
|
||||
@Resource
|
||||
private OrganMapper organMapper;
|
||||
|
||||
// 常用的字段key
|
||||
private static final String DATELIST_FIELD_NAME = "dateList";
|
||||
private static final String SERIES_FIELD_NAME = "series";
|
||||
@@ -488,4 +492,20 @@ public class OrganAmountServiceImpl implements OrganAmountService {
|
||||
}
|
||||
return newDateStrBuffer.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixOrganAmount() {
|
||||
List<OrganizationDO> organizationDOS = organMapper.selectList(new LambdaQueryWrapper<OrganizationDO>().select(OrganizationDO::getId));
|
||||
log.info("[fixOrganAmount][开始修正组织资金账户,组织总数({})]", organizationDOS.size());
|
||||
for (OrganizationDO organ : organizationDOS) {
|
||||
Long organId = organ.getId();
|
||||
OrganAmountDO organAmountDO = organAmountMapper.selectOne(new LambdaQueryWrapper<OrganAmountDO>().eq(OrganAmountDO::getOrganId, organId));
|
||||
if (ObjectUtil.isNull(organAmountDO)) {
|
||||
// 组织没有资金账户,新增一个
|
||||
organAmountMapper.insert(OrganAmountDO.builder()
|
||||
.organId(organId)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user