Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

jz.kai 3 лет назад
Родитель
Сommit
4b1cf754e1

+ 1 - 1
common/src/main/java/com/jpsoft/employment/modules/job/entity/JobUser.java

@@ -67,7 +67,7 @@ public class JobUser {
 	private String address;
 
 	@ApiModelProperty(value = "首次参加工作时间")
-	private Date firstJobTime;
+	private String firstJobTime;
 
 	@ApiModelProperty(value = "头像")
 	private String headImageUrl;

+ 2 - 2
common/src/main/resources/mapper/job/JobUser.xml

@@ -50,7 +50,7 @@
 ,#{sex,jdbcType=VARCHAR}
 ,#{birthday,jdbcType= TIMESTAMP }
 ,#{address,jdbcType=VARCHAR}
-,#{firstJobTime,jdbcType= TIMESTAMP }
+,#{firstJobTime,jdbcType= VARCHAR }
 ,#{headImageUrl,jdbcType=VARCHAR}
 ,#{isAuthentication,jdbcType= VARCHAR }
 ,#{idCard,jdbcType=VARCHAR}
@@ -105,7 +105,7 @@
 		address_=#{address,jdbcType=VARCHAR},
 		</if>
 				<if test="firstJobTime!=null">
-		first_job_time=#{firstJobTime,jdbcType= TIMESTAMP },
+		first_job_time=#{firstJobTime,jdbcType= VARCHAR },
 		</if>
 				<if test="headImageUrl!=null">
 		head_image_url=#{headImageUrl,jdbcType=VARCHAR},

+ 33 - 6
web/src/main/java/com/jpsoft/employment/modules/job/controller/HrIndexController.java

@@ -147,13 +147,31 @@ public class HrIndexController {
         try{
             Map<String,Object> map = new HashMap();
 
+            SimpleDateFormat sdf = new SimpleDateFormat("MM");
+
+            Date now = new Date();
+
+            Date lastMonth1 = getLastMonth(now);
+            Date lastMonth2 = getLastMonth(lastMonth1);
+            Date lastMonth3 = getLastMonth(lastMonth2);
+            Date lastMonth4 = getLastMonth(lastMonth3);
+            Date lastMonth5 = getLastMonth(lastMonth4);
+            Date lastMonth6 = getLastMonth(lastMonth5);
+
+            String monthStr1 = sdf.format(lastMonth1);
+            String monthStr2 = sdf.format(lastMonth2);
+            String monthStr3 = sdf.format(lastMonth3);
+            String monthStr4 = sdf.format(lastMonth4);
+            String monthStr5 = sdf.format(lastMonth5);
+            String monthStr6 = sdf.format(lastMonth6);
+
             List<String> xAxisList = new ArrayList<>();
-            xAxisList.add("一月");
-            xAxisList.add("二月");
-            xAxisList.add("三月");
-            xAxisList.add("四月");
-            xAxisList.add("五月");
-            xAxisList.add("六月");
+            xAxisList.add(monthStr6+"月");
+            xAxisList.add(monthStr5+"月");
+            xAxisList.add(monthStr4+"月");
+            xAxisList.add(monthStr3+"月");
+            xAxisList.add(monthStr2+"月");
+            xAxisList.add(monthStr1+"月");
 
             map.put("xAxisList",xAxisList);
 
@@ -227,4 +245,13 @@ public class HrIndexController {
     }
 
 
+    private Date getLastMonth(Date date){
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MONTH,-1);
+        Date lastMonth = cal.getTime();
+        return lastMonth;
+    }
+
+
 }

+ 10 - 3
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/JobUserApiController.java

@@ -33,12 +33,14 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.ValueOperations;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import sun.awt.IconInfo;
 import sun.misc.BASE64Decoder;
 
 import java.io.ByteArrayInputStream;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 
@@ -581,9 +583,9 @@ public class JobUserApiController {
             String headImageUrl,
             String realName,
             String sex,
-            Date birthday,
+            @DateTimeFormat(pattern = "yyyy-MM-dd")String birthday,
             String address,
-            Date firstJobTime,
+            String firstJobTime,
             String token,
             @RequestAttribute  String subject) {
         MessageResult<String> messageResult = new MessageResult<>();
@@ -598,7 +600,12 @@ public class JobUserApiController {
             jobUser.setHeadImageUrl(headImageUrl);
             jobUser.setRealName(realName);
             jobUser.setSex(sex);
-            jobUser.setBirthday(birthday);
+            if (StringUtils.isNotEmpty(birthday)) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                Date birthdayTime = sdf.parse(birthday);
+                jobUser.setBirthday(birthdayTime);
+            }
+
             jobUser.setAddress(address);
             jobUser.setFirstJobTime(firstJobTime);
             jobUser.setUpdateBy(subject);