Commit fb414b26 by ilal Committed by chenzg

提交

parent b2e69739
......@@ -80,4 +80,7 @@ public class SbgjjAssoDetailed extends Model<SbgjjAssoDetailed> {
@ApiModelProperty(value = "公积金基数 ", example = "公积金基数")
private String gjjjss;
@ApiModelProperty(value = "参保人员id ", example = "参保人员id")
private Integer cbryid;
}
\ No newline at end of file
package cn.timer.api.controller.sbgjj;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -32,6 +35,7 @@ import cn.timer.api.bean.sbgjj.SbgjjAssoDetailed;
import cn.timer.api.bean.sbgjj.SbgjjAssoYjzd;
import cn.timer.api.bean.sbgjj.SbgjjTypeDetails;
import cn.timer.api.bean.sbgjj.SbgjjYjCsbh;
import cn.timer.api.bean.xcgl.XcglAssoJsgzzx;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
......@@ -640,7 +644,7 @@ public class SocialSecurityFundController {
deta.setSbjss(insuredto.getJnjs());//社保基数******************
deta.setGjjjss(insuredto.getGjjJnjs());//公积金基数************
deta.setCbryid(cbryid);//
detalis.add(deta);
Logoutput("公司-社保:"+preval);
......@@ -759,7 +763,7 @@ public class SocialSecurityFundController {
deta.setCbfns(sbgjjfa.getCbmcName());//参保方案
deta.setSbjss(insuredto.getJnjs());//社保基数
deta.setGjjjss(insuredto.getGjjJnjs());//公积金基数
deta.setCbryid(cbryid);//
deta.insert();
Logoutput("公司-公积金:"+preval);
......@@ -1078,7 +1082,7 @@ public class SocialSecurityFundController {
deta.setCbfns(sbgjjfa.getCbmcName());//参保方案
deta.setSbjss(insuredto.getJnjs());//社保基数
deta.setGjjjss(insuredto.getGjjJnjs());//公积金基数
deta.setCbryid(insuredto.getId());//
detalis.add(deta);
gssocial += preval;
......@@ -1201,7 +1205,7 @@ public class SocialSecurityFundController {
deta.setCbfns(sbgjjfa.getCbmcName());//参保方案
deta.setSbjss(insuredto.getJnjs());//社保基数
deta.setGjjjss(insuredto.getGjjJnjs());//公积金基数
deta.setCbryid(insuredto.getId());//
deta.insert();
gsfund += preval;
......@@ -1387,6 +1391,129 @@ public class SocialSecurityFundController {
return new ResponseResult().success("成功", yjzdmxlist);
}
@GetMapping(value = "/generatemonthlybill/{time}")
@ApiOperation(value = "生成当月账单", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> GenerateMonthlyBill(@CurrentUser UserBean userBean,@PathVariable String time) throws ParseException {
DateFormat sdf = new SimpleDateFormat("yyyy-MM");
List<SbgjjAdminCbry> cbrys = SbgjjAdminCbry.builder().build().selectList(new QueryWrapper<SbgjjAdminCbry>().lambda().eq(SbgjjAdminCbry::getQyid, userBean.getOrgCode())
.eq(SbgjjAdminCbry::getState, 1).eq(SbgjjAdminCbry::getIsUse, 1).eq(SbgjjAdminCbry::getSbcbState, 1).eq(SbgjjAdminCbry::getGjjcbState, 1));
for(SbgjjAdminCbry sbgjj : cbrys) {
//社保
if(sbgjj.getSbjlStatime() != null && !sbgjj.getSbjlStatime().equals("")) {
if (sdf.parse(sbgjj.getSbjlStatime()).getTime() <= sdf.parse(time).getTime()) {
List<SbgjjAssoDetailed> sbv = SbgjjAssoDetailed.builder().build().selectList(new QueryWrapper<SbgjjAssoDetailed>().lambda().eq(SbgjjAssoDetailed::getUserId, sbgjj.getUserNum())
.eq(SbgjjAssoDetailed::getAttributionTime, time).eq(SbgjjAssoDetailed::getCbryid, sbgjj.getId()).eq(SbgjjAssoDetailed::getOrgCode, userBean.getOrgCode()));
if(sbv.size() == 0) {
List<SbgjjAssoDetailed> yjmxs = SbgjjAssoDetailed.builder().build().selectList(new QueryWrapper<SbgjjAssoDetailed>().lambda().eq(SbgjjAssoDetailed::getCbryid, sbgjj.getId())
.eq(SbgjjAssoDetailed::getAttributionTime, sbgjj.getSbjlStatime()));
List<SbgjjAssoDetailed> detailedlist = new ArrayList<SbgjjAssoDetailed>();
for(SbgjjAssoDetailed yj : yjmxs) {
SbgjjAssoDetailed deta = SbgjjAssoDetailed.builder().build();
deta.setUserId(yj.getUserId());
deta.setAttributionTime(time);//生成年月
deta.setCbfzmxId(yj.getCbfzmxId());
deta.setCoverageName(yj.getCoverageName());
deta.setPersonalAmount(yj.getPersonalAmount());
deta.setPersonalProportion(yj.getPersonalProportion());//个人比例
deta.setCompanyAmount(yj.getCompanyAmount());//公司金额
deta.setCompanyProportion(yj.getCompanyProportion());
deta.setXzType(yj.getXzType());//险种类型 1:社保;2:公积金
deta.setOrgCode(userBean.getOrgCode());
deta.setAddtime(new Date().getTime());
deta.setCbfns(yj.getCbfns());//参保方案
deta.setSbjss(yj.getSbjss());//社保基数******************
deta.setGjjjss(yj.getGjjjss());//公积金基数************
deta.setCbryid(yj.getCbryid());//
detailedlist.add(deta);
}
if(detailedlist.size()>0){
sbgjjassodetailedmapper.insertsbgjjassodetailedList(detailedlist);
}
//
if(!sbgjj.getSbjlStatime().equals(sbgjj.getGjjjlStatime())) {
List<SbgjjAssoDetailed> gjjy = SbgjjAssoDetailed.builder().build().selectList(new QueryWrapper<SbgjjAssoDetailed>().lambda().eq(SbgjjAssoDetailed::getCbryid, sbgjj.getId())
.eq(SbgjjAssoDetailed::getAttributionTime, sbgjj.getGjjjlStatime()));
List<SbgjjAssoDetailed> gjjylist = new ArrayList<SbgjjAssoDetailed>();
for(SbgjjAssoDetailed yj : gjjy) {
SbgjjAssoDetailed deta = SbgjjAssoDetailed.builder().build();
deta.setUserId(yj.getUserId());
deta.setAttributionTime(time);//生成年月
deta.setCbfzmxId(yj.getCbfzmxId());
deta.setCoverageName(yj.getCoverageName());
deta.setPersonalAmount(yj.getPersonalAmount());
deta.setPersonalProportion(yj.getPersonalProportion());//个人比例
deta.setCompanyAmount(yj.getCompanyAmount());//公司金额
deta.setCompanyProportion(yj.getCompanyProportion());
deta.setXzType(yj.getXzType());//险种类型 1:社保;2:公积金
deta.setOrgCode(userBean.getOrgCode());
deta.setAddtime(new Date().getTime());
deta.setCbfns(yj.getCbfns());//参保方案
deta.setSbjss(yj.getSbjss());//社保基数******************
deta.setGjjjss(yj.getGjjjss());//公积金基数************
deta.setCbryid(yj.getCbryid());//
gjjylist.add(deta);
}
if(gjjylist.size()>0){
sbgjjassodetailedmapper.insertsbgjjassodetailedList(gjjylist);
}
}
SbgjjAssoYjzd yjz = SbgjjAssoYjzd.builder().build().selectOne(new QueryWrapper<SbgjjAssoYjzd>().lambda().eq(SbgjjAssoYjzd::getCbryid, sbgjj.getId()).eq(SbgjjAssoYjzd::getZymonth, sbgjj.getSbjlStatime()));
if(yjz != null) {
SbgjjAssoYjzd yjzd = SbgjjAssoYjzd.builder().build();
yjzd.setUserNum(yjz.getUserNum());//用户工号
yjzd.setTotalmoney(yjz.getTotalmoney());//合计金额
yjzd.setGsjltotal(yjz.getGsjltotal());//公司缴纳合计
yjzd.setGrjltotal(yjz.getGrjltotal());//个人缴纳合计
yjzd.setZdtype(1);//账单类型 1:公司自缴
yjzd.setZymonth(time);//账单月份
yjzd.setSbfaid(yjz.getSbfaid());//社保参保方案id
yjzd.setGjjfaid(yjz.getGjjfaid());//公积金参保方案id
yjzd.setQyid(userBean.getOrgCode());
yjzd.setSbgshj(yjz.getSbgshj());//社保公司合计
yjzd.setSbgrhj(yjz.getSbgrhj());//社保个人合计
yjzd.setSbhj(yjz.getSbhj());//社保合计
yjzd.setGjjgshj("0.0");//公积金公司合计
yjzd.setGjjgrhj("0.0");//公积金个人合计
yjzd.setGjjhj("0.0");//公积金合计
yjzd.setCbryid(yjz.getCbryid());
sbgjjassoyjzdmapper.insertsbgjjassoyjzd(yjzd);
}
}
}
}
//社保公积金
if(sbgjj.getGjjjlStatime() != null && !sbgjj.getGjjjlStatime().equals("")) {
if (sdf.parse(sbgjj.getGjjjlStatime()).getTime() <= sdf.parse(time).getTime()) {
SbgjjAssoYjzd yjz = SbgjjAssoYjzd.builder().build().selectOne(new QueryWrapper<SbgjjAssoYjzd>().lambda().eq(SbgjjAssoYjzd::getUserNum, sbgjj.getUserNum())
.eq(SbgjjAssoYjzd::getZymonth, time).eq(SbgjjAssoYjzd::getQyid, userBean.getOrgCode()).eq(SbgjjAssoYjzd::getCbryid, sbgjj.getId()));
if(yjz != null) {
SbgjjAssoYjzd gjyz = SbgjjAssoYjzd.builder().build().selectOne(new QueryWrapper<SbgjjAssoYjzd>().lambda().eq(SbgjjAssoYjzd::getCbryid, sbgjj.getId()).eq(SbgjjAssoYjzd::getZymonth, sbgjj.getGjjjlStatime()));
if(gjyz != null) {
SbgjjAssoYjzd.builder().id(yjz.getId()).gjjgshj(gjyz.getGjjgshj()).gjjgrhj(gjyz.getGjjgrhj()).gjjhj(gjyz.getGjjhj()).build().updateById();
}
}
}
}
}
MonthlyStatementDto monthly = new MonthlyStatementDto();
monthly.setOrgcode(userBean.getOrgCode());
monthly.setMon(time);
List<MonthlyCheckoutSheetDto> yjzlist = sbgjjassoyjzdmapper.MonthlycheckoutsheetList(monthly);
return ResultUtil.data(yjzlist, "成功");
}
@Value("${config-8timer.environmental-science}")
public String environmental_science;
......
......@@ -21,10 +21,11 @@
<result column="cbfns" property="cbfns" />
<result column="sbjss" property="sbjss" />
<result column="gjjjss" property="gjjjss" />
<result column="cbryid" property="cbryid" />
</resultMap>
<insert id="insertsbgjjassodetailedList" parameterType="java.util.List" >
insert into sbgjj_asso_detailed (user_id,attribution_time,cbfzmx_id,coverage_name,personal_amount,personal_proportion,company_amount,company_proportion,xz_type,org_code,addtime,cbfns,sbjss,gjjjss)
insert into sbgjj_asso_detailed (user_id,attribution_time,cbfzmx_id,coverage_name,personal_amount,personal_proportion,company_amount,company_proportion,xz_type,org_code,addtime,cbfns,sbjss,gjjjss,cbryid)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.userId != null" >
......@@ -67,7 +68,10 @@
#{item.sbjss},
</if>
<if test="item.gjjjss != null" >
#{item.gjjjss}
#{item.gjjjss},
</if>
<if test="item.cbryid != null" >
#{item.cbryid}
</if>
)
</foreach>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment