| @@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import javax.validation.constraints.NotNull; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -46,17 +47,21 @@ public class WxCUserBasicInfo implements Serializable { | |||||
| /*微信用户绑定的手机号**/ | /*微信用户绑定的手机号**/ | ||||
| @Excel(name="手机",width = 20,orderNum = "2") | @Excel(name="手机",width = 20,orderNum = "2") | ||||
| @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | ||||
| @NotNull | |||||
| private String phone; | private String phone; | ||||
| /*出生日期**/ | /*出生日期**/ | ||||
| @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") | @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") | ||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | ||||
| private Date birthdate; | private Date birthdate; | ||||
| /*学历**/ | /*学历**/ | ||||
| @Excel(name="学历",width = 20,orderNum = "4") | @Excel(name="学历",width = 20,orderNum = "4") | ||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value="学历",name="education") | @io.swagger.annotations.ApiModelProperty(value="学历",name="education") | ||||
| private String education; | private String education; | ||||
| /*性别:0:保密 1.男 2女**/ | /*性别:0:保密 1.男 2女**/ | ||||
| @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") | @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") | ||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | ||||
| private Integer sex; | private Integer sex; | ||||
| /*邮箱**/ | /*邮箱**/ | ||||
| @@ -83,6 +88,7 @@ public class WxCUserBasicInfo implements Serializable { | |||||
| /*用户姓名**/ | /*用户姓名**/ | ||||
| @Excel(name="姓名",width = 20) | @Excel(name="姓名",width = 20) | ||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | ||||
| private String name; | private String name; | ||||
| @@ -302,29 +302,36 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| try { | try { | ||||
| ImportParams params = new ImportParams(); | ImportParams params = new ImportParams(); | ||||
| params.setTitleRows(1); | |||||
| params.setHeadRows(1); | |||||
| List<WxCUserBasicInfo> datalist = ExcelImportUtil.importExcel(file.getInputStream(),WxCUserBasicInfo.class, params); | List<WxCUserBasicInfo> datalist = ExcelImportUtil.importExcel(file.getInputStream(),WxCUserBasicInfo.class, params); | ||||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | ||||
| wxCUserBasicInfo.setTenantId(tenantId); | wxCUserBasicInfo.setTenantId(tenantId); | ||||
| List<WxCUserBasicInfo> list = wxCUserBasicInfoMapper.findList(wxCUserBasicInfo); | List<WxCUserBasicInfo> list = wxCUserBasicInfoMapper.findList(wxCUserBasicInfo); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| for(WxCUserBasicInfo user:datalist){ | for(WxCUserBasicInfo user:datalist){ | ||||
| WxCUserBasicInfo tempuser = list.stream().filter(u -> u.getPhone().equals(user.getPhone())).findFirst().get(); | |||||
| if(tempuser!=null){ | |||||
| tempuser.setSex(user.getSex()); | |||||
| tempuser.setEducation(user.getEducation()); | |||||
| tempuser.setBirthdate(user.getBirthdate()); | |||||
| tempuser.setName(user.getName()); | |||||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(tempuser); | |||||
| } else { | |||||
| user.setId(idWorker.nextId()); | |||||
| wxCUserBasicInfoMapper.insertSelective(user); | |||||
| if(user.getPhone()!=null){ | |||||
| WxCUserBasicInfo tempuser=null; | |||||
| if(list.size()>0){ | |||||
| tempuser = list.stream().filter(u -> u.getPhone().equals(user.getPhone())).findFirst().get(); | |||||
| } | |||||
| if(tempuser!=null){ | |||||
| tempuser.setTenantId(tenantId); | |||||
| tempuser.setSex(user.getSex()); | |||||
| tempuser.setEducation(user.getEducation()); | |||||
| tempuser.setBirthdate(user.getBirthdate()); | |||||
| tempuser.setName(user.getName()); | |||||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(tempuser); | |||||
| } else { | |||||
| user.setId(idWorker.nextId()); | |||||
| user.setTenantId(tenantId); | |||||
| wxCUserBasicInfoMapper.insertSelective(user); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| throw new MallinkException(500,"模板导入失败"); | |||||
| throw new MallinkException(500,"模板导入失败"+e); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS,"导入成功"); | return new ResultData(Result.SUCCESS,"导入成功"); | ||||
| @@ -32,7 +32,7 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and c.`tenant_id` like concat('%', #{tenantId},'%') | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | </if> | ||||
| <if test=" null != phone "> | <if test=" null != phone "> | ||||
| @@ -67,20 +67,16 @@ | |||||
| and `tag_id` = #{tagId} | and `tag_id` = #{tagId} | ||||
| </if> | </if> | ||||
| <if test=" null != cUserId "> | |||||
| and `c_user_id` = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != createDate "> | <if test=" null != createDate "> | ||||
| and c.`create_date` = #{createDate} | |||||
| and `create_date` = #{createDate} | |||||
| </if> | </if> | ||||
| <if test=" null != updateDate "> | <if test=" null != updateDate "> | ||||
| and c.`update_date` = #{updateDate} | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | </if> | ||||
| <if test=" null != name "> | <if test=" null != name "> | ||||
| and c.`name` like concat('%', #{name},'%') | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | </if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||