1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

体温上报功能完成;小程序更新npm依赖版本

This commit is contained in:
程序员小墨 2022-12-28 20:30:18 +08:00
parent 432ba2b812
commit 7d7a9313d5
13 changed files with 1109 additions and 876 deletions

View File

@ -5,6 +5,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@ -13,22 +14,14 @@ public class Report implements Serializable {
private Integer id;
private Integer user_id;
private Integer userId;
private String name;
private String address;
private String time;
private Date time;
private String normal;
private String yes_noon_temp;
private String yes_night_temp;
private String today_morning_temp;
private String isolation;
private Integer temperature;
}

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -6,7 +6,7 @@ import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface AccessDao {
public interface SettingDao {
Integer updateSetting(Setting setting);
Setting getValueByKey(String key);

View File

@ -1,7 +1,6 @@
package com.cxyxiaomo.epp.access.service;
import com.cxyxiaomo.epp.common.pojo.User;
import com.cxyxiaomo.epp.access.dao.AccessDao;
import com.cxyxiaomo.epp.access.dao.SettingDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -9,6 +8,6 @@ import org.springframework.stereotype.Service;
public class AccessServiceImpl implements AccessService {
@Autowired
private AccessDao accessDao;
private SettingDao accessDao;
}

View File

@ -0,0 +1,7 @@
package com.cxyxiaomo.epp.access.service;
import com.cxyxiaomo.epp.common.pojo.Report;
public interface ReportService {
void addRecord(Report report);
}

View File

@ -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);
}
}

View File

@ -2,7 +2,7 @@ package com.cxyxiaomo.epp.access.service;
import com.alibaba.fastjson2.JSON;
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.utils.RestUtil;
import com.cxyxiaomo.epp.common.pojo.Setting;
@ -20,7 +20,7 @@ import java.util.Map;
public class WeChatTokenServiceImpl implements WeChatTokenService {
@Autowired
AccessDao accessDao;
SettingDao accessDao;
// 数据库中该 key 保存的 time 是失效时间
final String SETTING_KEY = "wechat_access_token";

View File

@ -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>

View File

@ -2,7 +2,7 @@
<!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.AccessDao">
<mapper namespace="com.cxyxiaomo.epp.access.dao.SettingDao">
<insert id="updateSetting" parameterType="com.cxyxiaomo.epp.common.pojo.Setting">
INSERT INTO setting (`key`, `value`, `time`)
VALUES (#{key}, #{value}, #{time})

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
"projectname": "epp",
"setting": {
"compileHotReLoad": false,
"urlCheck": false
"urlCheck": false,
"bigPackageSizeSupport": true
}
}

View File

@ -173,7 +173,60 @@ export default {
})
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>