缴费
This commit is contained in:
+5
@@ -36,6 +36,11 @@ public class MobileMemberCostListController {
|
||||
public void paySuccess() {
|
||||
}
|
||||
|
||||
@At("/summary")
|
||||
@Ok("beetl:/mobile/memberCost/summary.html")
|
||||
public void summary() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
|
||||
+25
@@ -4,9 +4,11 @@ import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.memberCost.model.MemberPaymentConfig;
|
||||
import io.v.nutz.zhgh.memberCost.model.MemberPaymentProject;
|
||||
import io.v.nutz.zhgh.memberCost.service.MemberPaymentService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
@@ -56,6 +58,29 @@ public class MemberPaymentConfigController {
|
||||
return memberPaymentService.getConfig();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getPaymentConfigList(){
|
||||
return memberPaymentService.getPaymentConfigList();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doRemove(String id){
|
||||
memberPaymentService.dao().clear(MemberPaymentConfig.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object openClosedConfig(String id){
|
||||
//位运算 取反
|
||||
memberPaymentService.dao().update(MemberPaymentConfig.class,
|
||||
Chain.makeSpecial("isDisabled", "isDisabled ^ 1"),
|
||||
Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
|
||||
+47
-11
@@ -30,11 +30,13 @@ import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -122,13 +124,15 @@ public class MemberPaymentProjectController {
|
||||
memberPaymentService.clear(Cnd.where("paymentProjectId", "=", id));
|
||||
}
|
||||
|
||||
//获取缴费项目
|
||||
MemberPaymentProject project = memberPaymentService.dao().fetch(MemberPaymentProject.class, id);
|
||||
//获取缴费配置
|
||||
MemberPaymentConfig config = memberPaymentService.getConfig();
|
||||
MemberPaymentConfig config = memberPaymentService.getConfigById(project.getConfigId());
|
||||
List<MemberPaymentConfig.PayStandards> payStandards = config.getPayStandards();
|
||||
//缴费人员类型
|
||||
List<String> personTypeList = new ArrayList<>();
|
||||
payStandards.forEach(v->{
|
||||
personTypeList.addAll(v.getPersonTypes());
|
||||
personTypeList.add(v.getPersonType());
|
||||
});
|
||||
|
||||
//获取所有有入会时间的会员
|
||||
@@ -138,23 +142,37 @@ public class MemberPaymentProjectController {
|
||||
//过滤出需要新增到记录表中的人员
|
||||
List<Sys_user> needInsertUserIds = memberList.stream().filter(v -> !paymentUserIdList.contains(v.getId())).collect(Collectors.toList());
|
||||
|
||||
//获取缴费项目
|
||||
MemberPaymentProject project = memberPaymentService.dao().fetch(MemberPaymentProject.class, id);
|
||||
//该项目的缴费月份是几月到几月,转为数组,判断新入职教工应缴费几个月
|
||||
String[] strings = project.getPaymentStartMonth().substring(0, project.getPaymentStartMonth().length() - 1).split("-");
|
||||
DateTime beginDate = DateUtil.parse(project.getYear() + "-" + strings[0] + "-01");
|
||||
|
||||
//该缴费配置的缴费月份是几月到几月,转为数组
|
||||
String[] strings = {config.getPaymentStartMonth(),config.getPaymentEndMonth()};
|
||||
DateTime beginDate = DateUtil.parse(strings[0] + "-01");
|
||||
//获取月份的最后一天
|
||||
DateTime endDate = DateUtil.endOfMonth(DateUtil.parse(project.getYear() + "-" + strings[1] + "-01"));
|
||||
DateTime endDate = DateUtil.endOfMonth(DateUtil.parse(strings[1] + "-01"));
|
||||
|
||||
List<MemberPaymentInfo> memberPaymentInfos = new ArrayList<>();
|
||||
needInsertUserIds.forEach(v -> {
|
||||
MemberPaymentInfo paymentInfo = new MemberPaymentInfo();
|
||||
paymentInfo.setPersonType(v.getPersonType());
|
||||
long differMonth = 0;
|
||||
//如果是新入职教工,计算需要缴纳的月数
|
||||
if (v.getMemberJoinTime().after(beginDate) && v.getMemberJoinTime().before(endDate)){
|
||||
long differMonth = DateUtil.betweenMonth(v.getMemberJoinTime(), endDate, false);
|
||||
differMonth = DateUtil.betweenMonth(v.getMemberJoinTime(), endDate, false)+1;
|
||||
paymentInfo.setPaymentMonth(String.valueOf(differMonth));
|
||||
} else {
|
||||
paymentInfo.setPaymentMonth(config.getPaidDuration());
|
||||
paymentInfo.setPayPersonnel("新进会员");
|
||||
//getPayment(v, payStandards, paymentInfo, differMonth,"新进会员");
|
||||
|
||||
}else if(v.getRetireDate()!=null&&v.getRetireDate().after(beginDate)&&v.getRetireDate().before(endDate)){
|
||||
//如果是退休会员
|
||||
differMonth = DateUtil.betweenMonth(beginDate, v.getRetireDate(), false)+1;
|
||||
paymentInfo.setPaymentMonth(String.valueOf(differMonth));
|
||||
paymentInfo.setPayPersonnel("退休会员");
|
||||
//getPayment(v, payStandards, paymentInfo, differMonth,"退休会员");
|
||||
}else {
|
||||
//如果是普通会员
|
||||
differMonth = DateUtil.betweenMonth(beginDate, endDate, false)+1;
|
||||
paymentInfo.setPaymentMonth(String.valueOf(differMonth));
|
||||
paymentInfo.setPayPersonnel("普通会员");
|
||||
//getPayment(v, payStandards, paymentInfo, differMonth,"普通会员");
|
||||
}
|
||||
paymentInfo.setUserId(v.getId());
|
||||
paymentInfo.setLoginname(v.getLoginname());
|
||||
@@ -195,6 +213,24 @@ public class MemberPaymentProjectController {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void getPayment(Sys_user v, List<MemberPaymentConfig.PayStandards> payStandards, MemberPaymentInfo paymentInfo, long differMonth,String payPersonnel) {
|
||||
List<MemberPaymentConfig.PayStandards> list = payStandards.stream().filter(v1 -> v1.getPersonType().equals(v.getPersonType()) && payPersonnel.equals(v1.getPayPersonnel())).collect(Collectors.toList());
|
||||
MemberPaymentConfig.PayStandards standards = null;
|
||||
if (list!=null&&list.size()>0){
|
||||
standards = list.get(0);
|
||||
}
|
||||
if ("在编".equals(v.getPersonType())&&standards!=null){
|
||||
AtomicReference<Integer> value= new AtomicReference<>(0);
|
||||
standards.getPayModeValueList().forEach(v1->{
|
||||
value.set(value.get()+v1.getInt("value"));
|
||||
});
|
||||
paymentInfo.setPaymentMoney(String.valueOf(value.get()*0.05* differMonth));
|
||||
}
|
||||
if ("非编".equals(v.getPersonType())&&standards!=null){
|
||||
paymentInfo.setPaymentMoney(String.valueOf(Integer.valueOf(standards.getPayModeValue())* differMonth));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
|
||||
+2
-3
@@ -85,7 +85,6 @@ public class MemberPaymentSummaryController {
|
||||
u.sex,
|
||||
u.member,
|
||||
u.welfareMember,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unionname,
|
||||
u.unionid,
|
||||
@@ -111,7 +110,7 @@ public class MemberPaymentSummaryController {
|
||||
if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) {
|
||||
cnd.and(Cnd.likeEX(searchName, searchKeyword));
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H03")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H04")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
} else {
|
||||
@@ -173,7 +172,7 @@ public class MemberPaymentSummaryController {
|
||||
public Object modify(@Param("ids") String[] ids, String paymentMoney, boolean isPay, String remark) {
|
||||
List<String> idList = Arrays.asList(ids);
|
||||
if (Lang.isNotEmpty(idList)) {
|
||||
if (isPay) {
|
||||
if (!isPay) {
|
||||
//未缴费设为已缴费
|
||||
memberPaymentService.update(Chain.make("paymentMoney", paymentMoney)
|
||||
.add("remark", remark).add("isPayment", 1)
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package io.v.nutz.zhgh.memberCost.controller.payment;
|
||||
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.memberCost.model.MemberPaymentInfo;
|
||||
import io.v.nutz.zhgh.memberCost.model.MemberPaymentProject;
|
||||
import io.v.nutz.zhgh.memberCost.service.MemberPaymentService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 个人缴费管理
|
||||
* @author hpf
|
||||
*/
|
||||
@IocBean
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
@At("/platform/member/payment/user")
|
||||
public class MemberPaymentUserController {
|
||||
|
||||
@Inject
|
||||
private MemberPaymentService memberPaymentService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/memberCost/payment/user.html")
|
||||
@RequiresPermissions("member.payment.user")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.payment.user")
|
||||
public Object pageData(PageForm pageForm,@Param(value = "year", required = false) String year,@Param(value = "projectName", required = false) String projectName){
|
||||
Sql sql = Sqls.create("SELECT" +
|
||||
" mpi.*," +
|
||||
" mpp.`year`," +
|
||||
" mpp.projectName," +
|
||||
" mpp.startTime," +
|
||||
" mpp.endTime," +
|
||||
" mpp.configId," +
|
||||
" mpc.payStandards," +
|
||||
" mpc.paymentStartMonth," +
|
||||
" mpc.paymentEndMonth" +
|
||||
" FROM" +
|
||||
" member_payment_info mpi" +
|
||||
" LEFT JOIN member_payment_project mpp ON mpi.paymentProjectId = mpp.id " +
|
||||
" LEFT JOIN member_payment_config mpc ON mpc.id = mpp.configId $condition");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.andEX("mpp.isDisabled", "=", '0');
|
||||
cnd.andEX("mpp.year", "=", year);
|
||||
cnd.and("mpi.userId", "=", ShiroUtil.getUserId());
|
||||
if (Strings.isNotBlank(projectName)) {
|
||||
cnd.and(Cnd.likeEX("mpp.projectName", projectName));
|
||||
}
|
||||
cnd.desc("mpp.createTime");
|
||||
sql.setCondition(cnd);
|
||||
return memberPaymentService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.payment.user")
|
||||
public Object doSave(MemberPaymentInfo memberPaymentInfo) {
|
||||
memberPaymentService.insertOrUpdate(memberPaymentInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,11 +50,21 @@ public class MemberPaymentConfig extends BaseModel {
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isDisabled;
|
||||
|
||||
@Column
|
||||
@Comment("开始缴费月份")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String paymentStartMonth;
|
||||
|
||||
@Column
|
||||
@Comment("结束缴费月份")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String paymentEndMonth;
|
||||
|
||||
@Data
|
||||
public static class PayStandards implements Serializable {
|
||||
private String payPersonnel;
|
||||
private String payMode;
|
||||
private List<String> personTypes;
|
||||
private String personType;
|
||||
private String payModeValue;
|
||||
private List<NutMap> payModeValueList;
|
||||
}
|
||||
|
||||
@@ -87,4 +87,15 @@ public class MemberPaymentInfo {
|
||||
@Comment("缴费月份")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String paymentMonth;
|
||||
|
||||
@Column
|
||||
@Comment("人员类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String personType;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("会员类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String payPersonnel;
|
||||
}
|
||||
|
||||
@@ -58,4 +58,9 @@ public class MemberPaymentProject extends BaseModel {
|
||||
@Comment("结束缴费时间")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("缴费配置id")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
private String configId;
|
||||
}
|
||||
|
||||
@@ -17,4 +17,8 @@ public interface MemberPaymentService extends ViService<MemberPaymentInfo> {
|
||||
Workbook exportOrZip(List<NutMap> list, OutputStream outputStream)throws Exception;
|
||||
|
||||
MemberPaymentConfig getConfig();
|
||||
|
||||
List<MemberPaymentConfig> getPaymentConfigList();
|
||||
|
||||
MemberPaymentConfig getConfigById(String configId);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import io.v.nutz.zhgh.memberCost.model.MemberPaymentProject;
|
||||
import io.v.nutz.zhgh.memberCost.service.MemberPaymentService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -61,4 +62,14 @@ public class MemberPaymentServiceImpl extends ViServiceImpl<MemberPaymentInfo> i
|
||||
public MemberPaymentConfig getConfig() {
|
||||
return dao().fetch(MemberPaymentConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberPaymentConfig> getPaymentConfigList() {
|
||||
return dao().query(MemberPaymentConfig.class, Cnd.NEW().and("isDisabled","=","0"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberPaymentConfig getConfigById(String configId) {
|
||||
return dao().fetch(MemberPaymentConfig.class,configId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user