提案整改
This commit is contained in:
+9
-118
@@ -9,13 +9,13 @@ import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayManageUnionAllocateService;
|
||||
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutLayAllocateUnion;
|
||||
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutlayManageUnion;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
@@ -45,6 +45,8 @@ public class OutlayManageUnionAllocateController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private OutlayManageUnionAllocateService outlayManageUnionAllocateService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/outlay/outlayManage/union/allocate/index.html")
|
||||
@@ -88,59 +90,7 @@ public class OutlayManageUnionAllocateController {
|
||||
if (StrUtil.isEmpty(allocateMoney) || StrUtil.isEmpty(id)) {
|
||||
return Result.error("参数错误!");
|
||||
}
|
||||
|
||||
|
||||
OutLayAllocateUnion allocateUnion = baseService.dao().fetch(OutLayAllocateUnion.class, id);
|
||||
int quarter = DateUtil.month(DateUtil.date()) / 3 + 1;
|
||||
if (allocateUnion.getQuarterly() < quarter) {
|
||||
return Result.error("当前是第【" + quarter + "季度】无法修改【第" + allocateUnion.getQuarterly() + "季度】的额度!");
|
||||
}
|
||||
|
||||
baseService.dao().update(OutLayAllocateUnion.class, Chain.make("allocateMoney", allocateMoney),
|
||||
Cnd.where(OutLayAllocateUnion::getId, "=", id));
|
||||
|
||||
//找出今年工会的预算表
|
||||
OutlayManageUnion newOutlayManageUnion = baseService.dao().fetch(OutlayManageUnion.class,
|
||||
Cnd.where(OutlayManageUnion::getUnionId, "=", allocateUnion.getUnionId())
|
||||
.and(OutlayManageUnion::getYear, "=", DateUtil.thisYear()));
|
||||
|
||||
if (allocateUnion.getQuarterly() == 1) {
|
||||
//如果是第一季度,添加年度预算表
|
||||
Sys_union union = baseService.dao().fetch(Sys_union.class, allocateUnion.getUnionId());
|
||||
//找出去年剩余的钱
|
||||
OutlayManageUnion oldOutlayManageUnion = baseService.dao().fetch(OutlayManageUnion.class,
|
||||
Cnd.where(OutlayManageUnion::getUnionId, "=", allocateUnion.getUnionId())
|
||||
.and(OutlayManageUnion::getYear, "=", DateUtil.thisYear() - 1));
|
||||
|
||||
BigDecimal newTotalQuota = Lang.isNotEmpty(oldOutlayManageUnion) ? oldOutlayManageUnion.getTotalQuota().subtract(oldOutlayManageUnion.getUsedQuota()) : new BigDecimal(allocateMoney);
|
||||
|
||||
if (Lang.isNotEmpty(newOutlayManageUnion)) {
|
||||
//如果有今年的预算,代表第一季度已经分配过一次,现在修改
|
||||
newOutlayManageUnion.setTotalQuota(newTotalQuota);
|
||||
baseService.update(newOutlayManageUnion);
|
||||
} else {
|
||||
OutlayManageUnion manageUnion = new OutlayManageUnion();
|
||||
manageUnion.setYear(DateUtil.thisYear());
|
||||
manageUnion.setUnionId(union.getId());
|
||||
manageUnion.setUnionName(union.getName());
|
||||
manageUnion.setUnionCode(union.getUnionCode());
|
||||
//找出去年剩余多少钱,
|
||||
if (Lang.isNotEmpty(oldOutlayManageUnion)) {
|
||||
BigDecimal surplusMoney = oldOutlayManageUnion.getTotalQuota().subtract(oldOutlayManageUnion.getUsedQuota());
|
||||
//去年剩余的钱加上当年的分配金额
|
||||
manageUnion.setTotalQuota(surplusMoney.add(new BigDecimal(allocateMoney)));
|
||||
} else {
|
||||
manageUnion.setTotalQuota(new BigDecimal(allocateMoney));
|
||||
}
|
||||
manageUnion.setUsedQuota(BigDecimal.ZERO);
|
||||
baseService.insert(manageUnion);
|
||||
}
|
||||
} else {
|
||||
baseService.dao().update(OutlayManageUnion.class,
|
||||
Chain.make("totalQuota", newOutlayManageUnion.getTotalQuota().add(new BigDecimal(allocateMoney))),
|
||||
Cnd.where(OutlayManageUnion::getId, "=", newOutlayManageUnion.getId()));
|
||||
}
|
||||
return Result.success();
|
||||
return outlayManageUnionAllocateService.doEdit(id, new BigDecimal(allocateMoney));
|
||||
}
|
||||
|
||||
@At
|
||||
@@ -151,79 +101,20 @@ public class OutlayManageUnionAllocateController {
|
||||
public Result doBatchAllocate(@Param("allocateMoney") BigDecimal allocateMoney,
|
||||
@Param("quarterly") Integer quarterly,
|
||||
@Param("year") Integer year) {
|
||||
List<OutLayAllocateUnion> allocateUnionList = baseService.dao().query(OutLayAllocateUnion.class,
|
||||
Cnd.where(OutLayAllocateUnion::getQuarterly, "=", quarterly)
|
||||
.and(OutLayAllocateUnion::getYear, "=", year)
|
||||
.and(OutLayAllocateUnion::getDelFlag, "=", 0));
|
||||
|
||||
if (allocateUnionList == null || allocateUnionList.isEmpty()) {
|
||||
return Result.error("当前季度没有分配记录!");
|
||||
if (allocateMoney == null || quarterly == null || year == null) {
|
||||
return Result.error("参数错误!");
|
||||
}
|
||||
|
||||
for (OutLayAllocateUnion allocateUnion : allocateUnionList) {
|
||||
baseService.dao().update(OutLayAllocateUnion.class,
|
||||
Chain.make("allocateMoney", allocateMoney),
|
||||
Cnd.where(OutLayAllocateUnion::getId, "=", allocateUnion.getId()));
|
||||
|
||||
OutlayManageUnion newOutlayManageUnion = baseService.dao().fetch(OutlayManageUnion.class,
|
||||
Cnd.where(OutlayManageUnion::getUnionId, "=", allocateUnion.getUnionId())
|
||||
.and(OutlayManageUnion::getYear, "=", DateUtil.thisYear()));
|
||||
|
||||
if (allocateUnion.getQuarterly() == 1) {
|
||||
Sys_union union = baseService.dao().fetch(Sys_union.class, allocateUnion.getUnionId());
|
||||
OutlayManageUnion oldOutlayManageUnion = baseService.dao().fetch(OutlayManageUnion.class,
|
||||
Cnd.where(OutlayManageUnion::getUnionId, "=", allocateUnion.getUnionId())
|
||||
.and(OutlayManageUnion::getYear, "=", DateUtil.thisYear() - 1));
|
||||
|
||||
BigDecimal newTotalQuota = Lang.isNotEmpty(oldOutlayManageUnion)
|
||||
? oldOutlayManageUnion.getTotalQuota().subtract(oldOutlayManageUnion.getUsedQuota())
|
||||
: allocateMoney;
|
||||
|
||||
if (Lang.isNotEmpty(newOutlayManageUnion)) {
|
||||
newOutlayManageUnion.setTotalQuota(newTotalQuota);
|
||||
baseService.update(newOutlayManageUnion);
|
||||
} else {
|
||||
OutlayManageUnion manageUnion = new OutlayManageUnion();
|
||||
manageUnion.setYear(DateUtil.thisYear());
|
||||
manageUnion.setUnionId(union.getId());
|
||||
manageUnion.setUnionName(union.getName());
|
||||
manageUnion.setUnionCode(union.getUnionCode());
|
||||
if (Lang.isNotEmpty(oldOutlayManageUnion)) {
|
||||
BigDecimal surplusMoney = oldOutlayManageUnion.getTotalQuota().subtract(oldOutlayManageUnion.getUsedQuota());
|
||||
manageUnion.setTotalQuota(surplusMoney.add(allocateMoney));
|
||||
} else {
|
||||
manageUnion.setTotalQuota(allocateMoney);
|
||||
}
|
||||
manageUnion.setUsedQuota(BigDecimal.ZERO);
|
||||
baseService.insert(manageUnion);
|
||||
}
|
||||
} else {
|
||||
baseService.dao().update(OutlayManageUnion.class,
|
||||
Chain.make("totalQuota", newOutlayManageUnion.getTotalQuota().add(allocateMoney)),
|
||||
Cnd.where(OutlayManageUnion::getId, "=", newOutlayManageUnion.getId()));
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
return outlayManageUnionAllocateService.doBatchAllocate(allocateMoney, quarterly, year);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("重置预算季度记录")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "分工会预算-季度预算分配", msg = "重置预算季度记录")
|
||||
@SaCheckPermission("outlay.outlayManage.union.allocate")
|
||||
public Result deleteAllocateRecord() {
|
||||
int quarter = DateUtil.month(DateUtil.date()) / 3 + 1;
|
||||
// 查询当前季度
|
||||
int count = baseService.dao().count(OutLayAllocateUnion.class, Cnd.where(OutLayAllocateUnion::getQuarterly, "=", quarter)
|
||||
.and(OutLayAllocateUnion::getYear, "=", DateUtil.thisYear()));
|
||||
if (count == 0) {
|
||||
return Result.error("当前季度还未分配,无法重置!");
|
||||
}
|
||||
|
||||
baseService.dao().update(OutLayAllocateUnion.class, Chain.make("delFlag", 1),
|
||||
Cnd.where(OutLayAllocateUnion::getQuarterly, "=", quarter)
|
||||
.and(OutLayAllocateUnion::getYear, "=", DateUtil.thisYear()));
|
||||
return Result.success();
|
||||
return outlayManageUnionAllocateService.deleteAllocateRecord();
|
||||
}
|
||||
|
||||
@At
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class AIdFundPayRecordController {
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/aidFund/paexportYearPayRecordyRecord/index.html")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/aidFund/payRecord/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.aidFund.payRecord")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user