体温上报功能完成;小程序更新npm依赖版本
This commit is contained in:
parent
432ba2b812
commit
7d7a9313d5
@ -5,6 +5,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -13,22 +14,14 @@ public class Report implements Serializable {
|
|||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
private Integer user_id;
|
private Integer userId;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
private String time;
|
private Date time;
|
||||||
|
|
||||||
private String normal;
|
private Integer temperature;
|
||||||
|
|
||||||
private String yes_noon_temp;
|
|
||||||
|
|
||||||
private String yes_night_temp;
|
|
||||||
|
|
||||||
private String today_morning_temp;
|
|
||||||
|
|
||||||
private String isolation;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.cxyxiaomo.epp.access.controller;
|
||||||
|
|
||||||
|
import com.cxyxiaomo.epp.access.rpc.UserServiceFeign;
|
||||||
|
import com.cxyxiaomo.epp.access.service.ReportServiceImpl;
|
||||||
|
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||||
|
import com.cxyxiaomo.epp.common.pojo.User;
|
||||||
|
import com.cxyxiaomo.epp.common.response.Res;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/access/report")
|
||||||
|
public class ReportController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserServiceFeign userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportServiceImpl reportService;
|
||||||
|
|
||||||
|
@PostMapping("/submit")
|
||||||
|
@ResponseBody
|
||||||
|
public Res getCodeInfo(@RequestParam("userId") Integer id,
|
||||||
|
@RequestParam("address") String address,
|
||||||
|
@RequestParam("timestamp") Long timestamp,
|
||||||
|
@RequestParam("temperature") Integer temperature) {
|
||||||
|
User user = userService.getUserById(id);
|
||||||
|
if (user == null) {
|
||||||
|
return Res.error("用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询数据库,判断当天是否已经填报过
|
||||||
|
|
||||||
|
Calendar instance = Calendar.getInstance();
|
||||||
|
instance.setTimeInMillis(timestamp);
|
||||||
|
|
||||||
|
Report report = new Report();
|
||||||
|
report.setAddress(address);
|
||||||
|
report.setName(user.getRealname());
|
||||||
|
report.setTime(instance.getTime());
|
||||||
|
report.setUserId(user.getId());
|
||||||
|
report.setTemperature(temperature);
|
||||||
|
|
||||||
|
reportService.addRecord(report);
|
||||||
|
|
||||||
|
return Res.success();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.cxyxiaomo.epp.access.dao;
|
||||||
|
|
||||||
|
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface ReportDao {
|
||||||
|
Integer insert(Report report);
|
||||||
|
}
|
@ -6,7 +6,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@Repository
|
@Repository
|
||||||
public interface AccessDao {
|
public interface SettingDao {
|
||||||
Integer updateSetting(Setting setting);
|
Integer updateSetting(Setting setting);
|
||||||
|
|
||||||
Setting getValueByKey(String key);
|
Setting getValueByKey(String key);
|
@ -1,7 +1,6 @@
|
|||||||
package com.cxyxiaomo.epp.access.service;
|
package com.cxyxiaomo.epp.access.service;
|
||||||
|
|
||||||
import com.cxyxiaomo.epp.common.pojo.User;
|
import com.cxyxiaomo.epp.access.dao.SettingDao;
|
||||||
import com.cxyxiaomo.epp.access.dao.AccessDao;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -9,6 +8,6 @@ import org.springframework.stereotype.Service;
|
|||||||
public class AccessServiceImpl implements AccessService {
|
public class AccessServiceImpl implements AccessService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccessDao accessDao;
|
private SettingDao accessDao;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.cxyxiaomo.epp.access.service;
|
||||||
|
|
||||||
|
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||||
|
|
||||||
|
public interface ReportService {
|
||||||
|
void addRecord(Report report);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.cxyxiaomo.epp.access.service;
|
||||||
|
|
||||||
|
import com.cxyxiaomo.epp.access.dao.ReportDao;
|
||||||
|
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ReportServiceImpl implements ReportService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ReportDao reportDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRecord(Report report) {
|
||||||
|
reportDao.insert(report);
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ package com.cxyxiaomo.epp.access.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.cxyxiaomo.epp.access.dao.AccessDao;
|
import com.cxyxiaomo.epp.access.dao.SettingDao;
|
||||||
import com.cxyxiaomo.epp.access.pojo.UnlimitedQRCodeParam;
|
import com.cxyxiaomo.epp.access.pojo.UnlimitedQRCodeParam;
|
||||||
import com.cxyxiaomo.epp.access.utils.RestUtil;
|
import com.cxyxiaomo.epp.access.utils.RestUtil;
|
||||||
import com.cxyxiaomo.epp.common.pojo.Setting;
|
import com.cxyxiaomo.epp.common.pojo.Setting;
|
||||||
@ -20,7 +20,7 @@ import java.util.Map;
|
|||||||
public class WeChatTokenServiceImpl implements WeChatTokenService {
|
public class WeChatTokenServiceImpl implements WeChatTokenService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
AccessDao accessDao;
|
SettingDao accessDao;
|
||||||
|
|
||||||
// 数据库中该 key 保存的 time 是失效时间
|
// 数据库中该 key 保存的 time 是失效时间
|
||||||
final String SETTING_KEY = "wechat_access_token";
|
final String SETTING_KEY = "wechat_access_token";
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cxyxiaomo.epp.access.dao.ReportDao">
|
||||||
|
<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Report">
|
||||||
|
INSERT INTO report (`user_id`, `name`, `address`, `time`, `temperature`)
|
||||||
|
VALUES (#{userId}, #{name}, #{address}, #{time}, #{temperature})
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cxyxiaomo.epp.access.dao.AccessDao">
|
<mapper namespace="com.cxyxiaomo.epp.access.dao.SettingDao">
|
||||||
<insert id="updateSetting" parameterType="com.cxyxiaomo.epp.common.pojo.Setting">
|
<insert id="updateSetting" parameterType="com.cxyxiaomo.epp.common.pojo.Setting">
|
||||||
INSERT INTO setting (`key`, `value`, `time`)
|
INSERT INTO setting (`key`, `value`, `time`)
|
||||||
VALUES (#{key}, #{value}, #{time})
|
VALUES (#{key}, #{value}, #{time})
|
1799
miniprogram/package-lock.json
generated
1799
miniprogram/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
|||||||
"projectname": "epp",
|
"projectname": "epp",
|
||||||
"setting": {
|
"setting": {
|
||||||
"compileHotReLoad": false,
|
"compileHotReLoad": false,
|
||||||
"urlCheck": false
|
"urlCheck": false,
|
||||||
|
"bigPackageSizeSupport": true
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -173,7 +173,60 @@ export default {
|
|||||||
})
|
})
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
},
|
},
|
||||||
|
report() {
|
||||||
|
console.log("点击提交", "this.formData", this.formData)
|
||||||
|
|
||||||
|
Taro.showLoading({ title: '加载中' })
|
||||||
|
var that = this;
|
||||||
|
Taro.request({
|
||||||
|
url: `${this.baseUrl}/access/report/submit`,
|
||||||
|
method: "POST",
|
||||||
|
header: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded" //用于post
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
...this.formData,
|
||||||
|
},
|
||||||
|
success: function (d) {
|
||||||
|
that.debugMode && console.log("begin success")
|
||||||
|
Taro.hideLoading()
|
||||||
|
let result = d.data;
|
||||||
|
if (result.success) {
|
||||||
|
console.log("result.data", result.data);
|
||||||
|
Taro.showToast({
|
||||||
|
title: "填报成功",
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: result.msg,
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.isShow = ''
|
||||||
|
that.debugMode && console.log("end success")
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
that.debugMode && console.log("begin fail")
|
||||||
|
Taro.hideLoading()
|
||||||
|
Taro.showToast({
|
||||||
|
title: "请求失败",
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
that.debugMode && console.log("end fail")
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
that.debugMode && console.log("begin complete")
|
||||||
|
if (typeof (callback) === "function")
|
||||||
|
callback();
|
||||||
|
Taro.hideNavigationBarLoading();
|
||||||
|
that.debugMode && console.log("end complete")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user