Commit e38a8e2b by lal Committed by chenzg

提交社保公积金

parent b2e07b36
package cn.timer.api.bean.sbgjj;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author lal 2020-06-08
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "sbgjj_asso_detailed")
@ApiModel("月结明细")
public class SbgjjAssoDetailed extends Model<SbgjjAssoDetailed> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id id", example = "101")
private Integer id;
@ApiModelProperty(value = "用户id 用户id", example = "101")
private Integer userId;
@ApiModelProperty(value = "时间 ", example = "年月日")
private String attributionTime;
@ApiModelProperty(value = "参保方案明细id 参保方案明细id", example = "101")
private Integer cbfzmxId;
@ApiModelProperty(value = "险种名称 险种名称", example = "101")
private String coverageName;
@ApiModelProperty(value = "个人金额 ", example = "个人金额")
private Double personalAmount;
@ApiModelProperty(value = "公司金额 ", example = "公司金额")
private Double companyAmount;
@ApiModelProperty(value = "险种类型 1:社保;2:公积金", example = "101")
private Integer xzType;
@ApiModelProperty(value = "企业组织代码 ", example = "企业组织代码")
private Integer orgCode;
@ApiModelProperty(value = "生成时间 生成时间", example = "101")
private Long addtime;
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -19,7 +20,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.util.StrUtil;
......@@ -27,6 +27,7 @@ import cn.timer.api.bean.sbgjj.SbgjjAdminCbry;
import cn.timer.api.bean.sbgjj.SbgjjAreaInfo;
import cn.timer.api.bean.sbgjj.SbgjjAssoCbfa;
import cn.timer.api.bean.sbgjj.SbgjjAssoCbfzmx;
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;
......@@ -37,6 +38,7 @@ import cn.timer.api.dao.sbgjj.SbgjjAdminCbryMapper;
import cn.timer.api.dao.sbgjj.SbgjjAreaInfoMapper;
import cn.timer.api.dao.sbgjj.SbgjjAssoCbfaMapper;
import cn.timer.api.dao.sbgjj.SbgjjAssoCbfzmxMapper;
import cn.timer.api.dao.sbgjj.SbgjjAssoDetailedMapper;
import cn.timer.api.dao.sbgjj.SbgjjAssoYjzdMapper;
import cn.timer.api.dao.sbgjj.SbgjjTypeDetailsMapper;
import cn.timer.api.dao.sbgjj.SbgjjYjCsbhMapper;
......@@ -448,6 +450,26 @@ public class SocialSecurityFundController {
}
/**
* 参保员工号-根据 模糊 + 高級查詢-分页****************************************************************8
*/
@PostMapping(value = "/insured_employees")
@ApiOperation(value = "参保员工号-根据 模糊 + 高級查詢-分页", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 34)
public Result<Object> InsuredEmployees(@CurrentUser UserBean userBean, @Validated @RequestBody InspersonnelDto inspe){
IPage<InsuredPersonnelDto> page = new Page<InsuredPersonnelDto>(
inspe.getCurrentPage() == null ? 1 : inspe.getCurrentPage(),
inspe.getTotalPage() == null ? 10 : inspe.getTotalPage());
inspe.setOrgcode(userBean.getOrgCode());
IPage<InsuredPersonnelDto> pageAs = sbgjjadmincbrymapper.InsuredEmployees(page, inspe);
List<InsuredPersonnelDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
}
@GetMapping(value = "/insure/{name}")
@ApiOperation(value = "投保事件", httpMethod = "GET", notes = "接口发布说明")
public ResponseResult InsuranceIncident(@CurrentUser UserBean userBean,@PathVariable String name) {
......@@ -476,6 +498,9 @@ public class SocialSecurityFundController {
}
@Autowired
private SbgjjAssoDetailedMapper sbgjjassodetailedmapper;
@PostMapping(value = "/insuplan")
@ApiOperation(value = "投保", httpMethod = "POST", notes = "接口发布说明")
public ResponseResult InsurancePlan(@CurrentUser UserBean userBean,@RequestBody InsureDto insuredto) {
......@@ -532,6 +557,8 @@ public class SocialSecurityFundController {
sbgjjadmincbrymapper.insertsbgjjadmincbry(cbry);
int cbryid = cbry.getId();//参保人员
List<SbgjjAssoDetailed> detalis = new ArrayList<SbgjjAssoDetailed>();
//*************************************社保******************************************************
double gssocial = 0;//公司社保总
double grsocial = 0;//个人社保总
......@@ -541,6 +568,9 @@ public class SocialSecurityFundController {
//社保******
//公司
SbgjjAssoDetailed.builder().build().delete(new QueryWrapper<SbgjjAssoDetailed>().lambda().eq(SbgjjAssoDetailed::getUserId, Integer.valueOf(usernums[f])).eq(SbgjjAssoDetailed::getOrgCode, userBean.getOrgCode())
.eq(SbgjjAssoDetailed::getAttributionTime, insuredto.getJnmouth()));
for(SbgjjAssoCbfzmx sbjs:shebaolist) {
double jishuxx = 0;
double preval = 0;
......@@ -557,10 +587,30 @@ public class SocialSecurityFundController {
double gsh = gsbili.divide(bfb).doubleValue();
preval = formatDouble1(Double.valueOf(jishuxx)*gsh);
}
SbgjjAssoDetailed deta = SbgjjAssoDetailed.builder().build();
deta.setUserId(Integer.valueOf(usernums[f]));
deta.setAttributionTime(insuredto.getJnmouth());//
deta.setCbfzmxId(sbjs.getId());
deta.setCoverageName(sbjs.getXz());
deta.setPersonalAmount(0.0);
deta.setCompanyAmount(preval);//公司金额
deta.setXzType(1);//险种类型 1:社保;2:公积金
deta.setOrgCode(userBean.getOrgCode());
deta.setAddtime(new Date().getTime());
detalis.add(deta);
System.out.println("公司-社保:"+preval);
gssocial += preval;
}
System.out.println("公司社保总:"+formatDouble1(gssocial));
if(detalis.size()>0){
sbgjjassodetailedmapper.insertsbgjjassodetailedList(detalis);
}
//个人
for(SbgjjAssoCbfzmx sbjsgr:shebaolist) {
......@@ -579,6 +629,16 @@ public class SocialSecurityFundController {
double gsh = gsbigr.divide(bfgr).doubleValue();
preval = formatDouble1(Double.valueOf(jishuxxgr)*gsh);
}
SbgjjAssoDetailed dtd = sbgjjassodetailedmapper.selectOne(new QueryWrapper<SbgjjAssoDetailed>().lambda().eq(SbgjjAssoDetailed::getUserId, Integer.valueOf(usernums[f]))
.eq(SbgjjAssoDetailed::getAttributionTime, insuredto.getJnmouth()).eq(SbgjjAssoDetailed::getCbfzmxId, sbjsgr.getId()).eq(SbgjjAssoDetailed::getCoverageName, sbjsgr.getXz())
.eq(SbgjjAssoDetailed::getOrgCode, userBean.getOrgCode()));
if(dtd != null) {
SbgjjAssoDetailed.builder().id(dtd.getId()).personalAmount(preval).build().updateById();
}
System.out.println("个人-社保:"+preval);
grsocial += preval;
}
......@@ -637,6 +697,21 @@ public class SocialSecurityFundController {
double gsh = gsbili.divide(bfb).doubleValue();
preval = formatDouble1(Double.valueOf(jishuxx)*gsh);
}
SbgjjAssoDetailed deta = SbgjjAssoDetailed.builder().build();
deta.setUserId(Integer.valueOf(usernums[f]));
deta.setAttributionTime(insuredto.getJnmouth());//
deta.setCbfzmxId(gjjgs.getId());
deta.setCoverageName(gjjgs.getXz());
deta.setPersonalAmount(0.0);
deta.setCompanyAmount(preval);//公司金额
deta.setXzType(2);//险种类型 1:社保;2:公积金
deta.setOrgCode(userBean.getOrgCode());
deta.setAddtime(new Date().getTime());
deta.insert();
System.out.println("公司-公积金:"+preval);
gsfund += preval;
}
System.out.println("公司公积金总:"+formatDouble1(gsfund));
......@@ -660,6 +735,14 @@ public class SocialSecurityFundController {
preval = formatDouble1(Double.valueOf(jishuxxgr)*gsh);
}
SbgjjAssoDetailed dtd = sbgjjassodetailedmapper.selectOne(new QueryWrapper<SbgjjAssoDetailed>().lambda().eq(SbgjjAssoDetailed::getUserId, Integer.valueOf(usernums[f]))
.eq(SbgjjAssoDetailed::getAttributionTime, insuredto.getJnmouth()).eq(SbgjjAssoDetailed::getCbfzmxId, gjjgr.getId()).eq(SbgjjAssoDetailed::getCoverageName, gjjgr.getXz())
.eq(SbgjjAssoDetailed::getOrgCode, userBean.getOrgCode()));
if(dtd!=null) {
SbgjjAssoDetailed.builder().id(dtd.getId()).personalAmount(preval).build().updateById();
}
System.out.println("个人-公积金:"+preval);
grgsfund += preval;
}
System.out.println("个人公积金总:"+formatDouble1(grgsfund));
......
package cn.timer.api.dao.sbgjj;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.sbgjj.SbgjjAdminCbry;
import cn.timer.api.bean.yggl.YgglMainEmp;
......@@ -23,4 +25,7 @@ public interface SbgjjAdminCbryMapper extends BaseMapper<SbgjjAdminCbry> {
List<YgglMainEmp> EmployeeListByorgCode(int orgCode);
IPage<InsuredPersonnelDto> InsuredEmployees(IPage<InsuredPersonnelDto> page,@Param("param") InspersonnelDto inspe);
}
package cn.timer.api.dao.sbgjj;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.sbgjj.SbgjjAssoDetailed;
/**
* 月结明细
* @author Tang 2020-06-08
*/
@Repository
public interface SbgjjAssoDetailedMapper extends BaseMapper<SbgjjAssoDetailed> {
int insertsbgjjassodetailedList(List<SbgjjAssoDetailed> sbgjjassodetailed);
}
......@@ -10,7 +10,8 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InspersonnelDto extends Page implements Serializable{/**
public class InspersonnelDto extends Page implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6982449363339703887L;
......
......@@ -149,6 +149,7 @@
<select id="EmployeeListByorgCode" resultMap="YgglEmpInfoMap">
select * from yggl_main_emp
where org_code = #{orgCode,jdbcType=VARCHAR}
and job_status = 1
and emp_num not in (select cbry.user_num from sbgjj_admin_cbry cbry where cbry.qyid = #{orgCode,jdbcType=VARCHAR})
</select>
......@@ -185,6 +186,38 @@
</if>
</select>
<select id="InsuredEmployees" resultMap="InsuredPersonnelMap">
select emp.emp_num as empnum,
emp.`name` as empname,
emp.phone as emphone,
emp.zj_num as emzjnum,
cbry.id as cbryid,
cbry.cbfacs as cbfacs,
csbh.id as csid,
bmgw.dept,
bmgw.post,
cbry.sbcb_state as sbcbstate,
cbry.gjjcb_state as gjjcbstate,
cbry.jl_mode as jlmode,
cbry.sbfaid as sbfaid,
cbry.sbjl_statime as sbjlstatime,
cbry.sbjljs as sbjljs,
cbry.gjjfaid as gjjfaid,
cbry.gjjjl_statime as gjjjlstatime,
cbry.gjjjljs as gjjjljs
from yggl_main_emp emp
LEFT JOIN sbgjj_admin_cbry as cbry on cbry.user_num = emp.emp_num and cbry.state = 1
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id
) as bmgw on bmgw.mid = emp.bmgw_id
LEFT JOIN sbgjj_yj_csbh as csbh on csbh.city_name = cbry.cbfacs
where emp.org_code = #{param.orgcode}
<if test="param.title != null" >
and (emp.`name` like CONCAT('%',#{param.title},'%') or emp.emp_num = #{param.title})
</if>
</select>
<insert id="insertsbgjjadmincbry" parameterType="cn.timer.api.bean.sbgjj.SbgjjAdminCbry" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sbgjj_admin_cbry
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.sbgjj.SbgjjAssoDetailedMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.sbgjj.SbgjjAssoDetailed" >
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="attribution_time" property="attributionTime" />
<result column="cbfzmx_id" property="cbfzmxId" />
<result column="coverage_name" property="coverageName" />
<result column="personal_amount" property="personalAmount" />
<result column="company_amount" property="companyAmount" />
<result column="xz_type" property="xzType" />
<result column="org_code" property="orgCode" />
<result column="addtime" property="addtime" />
</resultMap>
<sql id="Base_Column_List">
id,
user_id,
attribution_time,
cbfzmx_id,
coverage_name,
personal_amount,
company_amount,
xz_type,
org_code,
addtime
</sql>
<sql id="Base_Column_List_Alias">
id SbgjjAssoDetailed_id,
user_id SbgjjAssoDetailed_user_id,
attribution_time SbgjjAssoDetailed_attribution_time,
cbfzmx_id SbgjjAssoDetailed_cbfzmx_id,
coverage_name SbgjjAssoDetailed_coverage_name,
personal_amount SbgjjAssoDetailed_personal_amount,
company_amount SbgjjAssoDetailed_company_amount,
xz_type SbgjjAssoDetailed_xz_type,
org_code SbgjjAssoDetailed_org_code,
addtime SbgjjAssoDetailed_addtime
</sql>
<insert id="insertsbgjjassodetailedList" parameterType="java.util.List" >
insert into sbgjj_asso_detailed (user_id,attribution_time,cbfzmx_id,coverage_name,personal_amount,company_amount,xz_type,org_code,addtime)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.userId != null" >
#{item.userId},
</if>
<if test="item.attributionTime != null" >
#{item.attributionTime},
</if>
<if test="item.cbfzmxId != null" >
#{item.cbfzmxId},
</if>
<if test="item.coverageName != null" >
#{item.coverageName},
</if>
<if test="item.personalAmount != null" >
#{item.personalAmount},
</if>
<if test="item.companyAmount != null" >
#{item.companyAmount},
</if>
<if test="item.xzType != null" >
#{item.xzType},
</if>
<if test="item.orgCode != null" >
#{item.orgCode},
</if>
<if test="item.addtime != null" >
#{item.addtime}
</if>
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.sbgjj.SbgjjAssoDetailed">
INSERT INTO sbgjj_asso_detailed
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != userId'>
user_id,
</if>
<if test ='null != attributionTime'>
attribution_time,
</if>
<if test ='null != cbfzmxId'>
cbfzmx_id,
</if>
<if test ='null != coverageName'>
coverage_name,
</if>
<if test ='null != personalAmount'>
personal_amount,
</if>
<if test ='null != companyAmount'>
company_amount,
</if>
<if test ='null != xzType'>
xz_type,
</if>
<if test ='null != orgCode'>
org_code,
</if>
<if test ='null != addtime'>
addtime
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != userId'>
#{userId},
</if>
<if test ='null != attributionTime'>
#{attributionTime},
</if>
<if test ='null != cbfzmxId'>
#{cbfzmxId},
</if>
<if test ='null != coverageName'>
#{coverageName},
</if>
<if test ='null != personalAmount'>
#{personalAmount},
</if>
<if test ='null != companyAmount'>
#{companyAmount},
</if>
<if test ='null != xzType'>
#{xzType},
</if>
<if test ='null != orgCode'>
#{orgCode},
</if>
<if test ='null != addtime'>
#{addtime}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM sbgjj_asso_detailed
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.sbgjj.SbgjjAssoDetailed">
UPDATE sbgjj_asso_detailed
<set>
<if test ='null != userId'>user_id = #{userId},</if>
<if test ='null != attributionTime'>attribution_time = #{attributionTime},</if>
<if test ='null != cbfzmxId'>cbfzmx_id = #{cbfzmxId},</if>
<if test ='null != coverageName'>coverage_name = #{coverageName},</if>
<if test ='null != personalAmount'>personal_amount = #{personalAmount},</if>
<if test ='null != companyAmount'>company_amount = #{companyAmount},</if>
<if test ='null != xzType'>xz_type = #{xzType},</if>
<if test ='null != orgCode'>org_code = #{orgCode},</if>
<if test ='null != addtime'>addtime = #{addtime}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM sbgjj_asso_detailed
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM sbgjj_asso_detailed
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM sbgjj_asso_detailed
</select>
-->
</mapper>
\ No newline at end of file
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