Browse Source

活动报名增加报名人员信息显示

yanliming 2 years ago
parent
commit
aebfd9dc23

+ 86 - 1
src/main/java/com/jpsoft/making_friends/modules/mgr/controller/ActivityMemberController.java

@@ -7,9 +7,12 @@ import com.jpsoft.making_friends.dto.MessageResult;
 import com.jpsoft.making_friends.dto.utils.OSSUtil;
 import com.jpsoft.making_friends.dto.utils.PojoUtils;
 import com.jpsoft.making_friends.entity.base.ActivityMember;
+import com.jpsoft.making_friends.entity.base.City;
 import com.jpsoft.making_friends.entity.base.MemberInfo;
 import com.jpsoft.making_friends.service.base.ActivityMemberService;
+import com.jpsoft.making_friends.service.base.CityService;
 import com.jpsoft.making_friends.service.base.MemberInfoService;
+import com.jpsoft.making_friends.service.sys.DataDictionaryService;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.mapping.ResultMap;
@@ -43,6 +46,12 @@ public class ActivityMemberController {
 
     @Autowired
     private OSSConfig ossConfig;
+
+    @Autowired
+    private CityService cityService;
+
+    @Autowired
+    private DataDictionaryService dictionaryService;
 	
 	
 	@ApiOperation(value="创建空记录")
@@ -252,18 +261,53 @@ public class ActivityMemberController {
                 String phone = "";
                 String createTime="";
 
+                String genderN = "";
+                Integer age = null;
+                String workUnit = "";
+                String workplaceN = "";
+                String educationN = "";
+
                 MemberInfo memberInfo = memberInfoService.get(activityMember.getMemberId());
 
                 if(memberInfo!=null){
                     realName = memberInfo.getRealName();
                     idCard = memberInfo.getIdCard();
                     phone = memberInfo.getPhone();
+
+                    if(memberInfo.getGender()){
+                        genderN = "男";
+                    }
+                    else if(!memberInfo.getGender()){
+                        genderN = "女";
+                    }
+
+
+
+                    age = memberInfo.getAge();
+                    workUnit = memberInfo.getWorkUnit();
+
+                    //工作地
+                    if(StringUtils.isNotEmpty(memberInfo.getWorkplace())){
+                        workplaceN = getPlaceN(memberInfo.getWorkplace());
+                    }
+
+
+                    //学历
+                    if(StringUtils.isNotEmpty(memberInfo.getEducation())){
+                        educationN = dictionaryService.findNameByCatalogNameAndValue("学历",memberInfo.getEducation());
+                    }
                 }
 
 
                 curMap.put("realName",realName);
                 curMap.put("idCard",idCard);
                 curMap.put("phone",phone);
+                curMap.put("genderN",genderN);
+                curMap.put("age",age);
+                curMap.put("workUnit",workUnit);
+                curMap.put("workplace",workplaceN);
+                curMap.put("education",educationN);
+
 
                 if(activityMember.getCreateTime()!=null){
                     createTime = sdf.format(activityMember.getCreateTime());
@@ -308,7 +352,7 @@ public class ActivityMemberController {
         //表头
         Row rowTitle = sheet.createRow(0);
 
-        String[] titles = new String[]{"序号", "用户姓名", "电话", "身份证",  "报名时间"};
+        String[] titles = new String[]{"序号", "用户姓名", "电话", "身份证","性别","年龄","工作单位","工作所在地","学历", "报名时间"};
 
         for (int i = 0; i < titles.length; i++) {
             Cell cell = rowTitle.createCell(i);
@@ -325,6 +369,13 @@ public class ActivityMemberController {
             row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("realName"), ""));
             row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("idCard"), ""));
             row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("phone"), ""));
+
+            row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("genderN"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("age"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("workUnit"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("workplace"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("education"), ""));
+
             row.createCell(colIndex++).setCellValue(com.jpsoft.making_friends.common.utils.StringUtils.strValue(map.get("createTime"), ""));
         }
 
@@ -344,4 +395,38 @@ public class ActivityMemberController {
         return downloadUrl;
     }
 
+
+    private int[] getPlace(String place){
+        int[] placeArr = new int[3];
+        if(StringUtils.isNotEmpty(place)){
+            City region = cityService.get(place);
+            if(region!=null){
+                City city = cityService.get(region.getPid().toString());
+
+                placeArr[0] = city.getPid();
+                placeArr[1] = city.getId();
+                placeArr[2] = region.getId();
+            }
+        }
+
+        return placeArr;
+    }
+
+    //翻译地区
+    private String getPlaceN(String place){
+        String placeN="";
+        if(StringUtils.isNotEmpty(place)){
+            City region = cityService.get(place);
+            if(region!=null){
+                City city = cityService.get(region.getPid().toString());
+
+                if(city!=null){
+                    City pro = cityService.get(city.getPid().toString());
+                    placeN=pro.getCityName()+"/"+city.getCityName()+"/"+region.getCityName();
+                }
+            }
+        }
+        return placeN;
+    }
+
 }