正在显示
8 个修改的文件
包含
41 行增加
和
17 行删除
| @@ -2,11 +2,14 @@ package com.sunyo.energy.location.controller; | @@ -2,11 +2,14 @@ package com.sunyo.energy.location.controller; | ||
| 2 | 2 | ||
| 3 | import com.sunyo.energy.location.controller.response.ResultJson; | 3 | import com.sunyo.energy.location.controller.response.ResultJson; | 
| 4 | import com.sunyo.energy.location.dao.LocationMapper; | 4 | import com.sunyo.energy.location.dao.LocationMapper; | 
| 5 | +import com.sunyo.energy.location.dao.USERSMapper; | ||
| 6 | +import com.sunyo.energy.location.model.USERS; | ||
| 5 | import com.sunyo.energy.location.service.LocationService; | 7 | import com.sunyo.energy.location.service.LocationService; | 
| 6 | import com.sunyo.energy.location.service.WaterMeterService; | 8 | import com.sunyo.energy.location.service.WaterMeterService; | 
| 7 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; | 
| 8 | import io.swagger.annotations.ApiOperation; | 10 | import io.swagger.annotations.ApiOperation; | 
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; | 
| 12 | +import org.springframework.util.StringUtils; | ||
| 10 | import org.springframework.web.bind.annotation.PostMapping; | 13 | import org.springframework.web.bind.annotation.PostMapping; | 
| 11 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; | 
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 15 | import org.springframework.web.bind.annotation.RequestParam; | 
| @@ -31,11 +34,14 @@ public class UserPayController { | @@ -31,11 +34,14 @@ public class UserPayController { | ||
| 31 | @Autowired | 34 | @Autowired | 
| 32 | private LocationMapper locationMapper; | 35 | private LocationMapper locationMapper; | 
| 33 | 36 | ||
| 37 | + @Autowired | ||
| 38 | + private USERSMapper usersMapper; | ||
| 39 | + | ||
| 34 | @ApiOperation(value = "查看缴费房间") | 40 | @ApiOperation(value = "查看缴费房间") | 
| 35 | @RequestMapping("/list") | 41 | @RequestMapping("/list") | 
| 36 | public List userPayList(@RequestParam(value = "roomNumber", required = false) String roomNumber) { | 42 | public List userPayList(@RequestParam(value = "roomNumber", required = false) String roomNumber) { | 
| 37 | 43 | ||
| 38 | - return locationService.userPayList(roomNumber); | 44 | + return locationService.userPayList(roomNumber, 0); | 
| 39 | } | 45 | } | 
| 40 | 46 | ||
| 41 | @ApiOperation(value = "充值水费") | 47 | @ApiOperation(value = "充值水费") | 
| @@ -60,15 +66,16 @@ public class UserPayController { | @@ -60,15 +66,16 @@ public class UserPayController { | ||
| 60 | 66 | ||
| 61 | @ApiOperation(value = "钉钉小程序请求水电返回数据") | 67 | @ApiOperation(value = "钉钉小程序请求水电返回数据") | 
| 62 | @PostMapping("/mincData") | 68 | @PostMapping("/mincData") | 
| 63 | - public Map<String, Object> mincData(@RequestParam(value = "loginName", required = false) String loginName) { | ||
| 64 | - | ||
| 65 | - Map<String, Object> map = new HashMap<>(); | ||
| 66 | - /** | ||
| 67 | - * 查询该账号所绑定的水电编号 | ||
| 68 | - */ | ||
| 69 | - | ||
| 70 | - | ||
| 71 | - return map; | 69 | + public List mincData(@RequestParam(value = "userName", required = false) String userName, | 
| 70 | + @RequestParam(value = "mobile", required = false) String mobile) { | ||
| 71 | + | ||
| 72 | + USERS users = usersMapper.findRoomNumber(mobile); | ||
| 73 | + if (!StringUtils.isEmpty(users.getUsername())){ | ||
| 74 | + List list = locationService.userPayList(users.getUsername(), users.getUserId()); | ||
| 75 | + return list; | ||
| 76 | + }else { | ||
| 77 | + return null; | ||
| 78 | + } | ||
| 72 | } | 79 | } | 
| 73 | 80 | ||
| 74 | } | 81 | } | 
| 1 | package com.sunyo.energy.location.dao; | 1 | package com.sunyo.energy.location.dao; | 
| 2 | 2 | ||
| 3 | import com.sunyo.energy.location.model.USERS; | 3 | import com.sunyo.energy.location.model.USERS; | 
| 4 | +import org.apache.ibatis.annotations.Param; | ||
| 4 | 5 | ||
| 5 | public interface USERSMapper { | 6 | public interface USERSMapper { | 
| 6 | int deleteByPrimaryKey(Integer userId); | 7 | int deleteByPrimaryKey(Integer userId); | 
| @@ -11,6 +12,8 @@ public interface USERSMapper { | @@ -11,6 +12,8 @@ public interface USERSMapper { | ||
| 11 | 12 | ||
| 12 | USERS selectByPrimaryKey(Integer userId); | 13 | USERS selectByPrimaryKey(Integer userId); | 
| 13 | 14 | ||
| 15 | + USERS findRoomNumber(@Param("mobile") String mobile); | ||
| 16 | + | ||
| 14 | int updateByPrimaryKeySelective(USERS record); | 17 | int updateByPrimaryKeySelective(USERS record); | 
| 15 | 18 | ||
| 16 | int updateByPrimaryKey(USERS record); | 19 | int updateByPrimaryKey(USERS record); | 
| @@ -9,7 +9,6 @@ import com.sunyo.energy.location.utils.Md5Utils; | @@ -9,7 +9,6 @@ import com.sunyo.energy.location.utils.Md5Utils; | ||
| 9 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; | 
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; | 
| 11 | import org.springframework.beans.factory.annotation.Value; | 11 | import org.springframework.beans.factory.annotation.Value; | 
| 12 | -import org.springframework.scheduling.annotation.Scheduled; | ||
| 13 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; | 
| 14 | 13 | ||
| 15 | import java.math.BigDecimal; | 14 | import java.math.BigDecimal; | 
| @@ -30,7 +30,7 @@ public class LocationServiceImp implements LocationService { | @@ -30,7 +30,7 @@ public class LocationServiceImp implements LocationService { | ||
| 30 | WaterMeterService waterMeterService; | 30 | WaterMeterService waterMeterService; | 
| 31 | 31 | ||
| 32 | @Override | 32 | @Override | 
| 33 | - public List userPayList(String roomNumber) { | 33 | + public List userPayList(String roomNumber, int userId) { | 
| 34 | 34 | ||
| 35 | try { | 35 | try { | 
| 36 | // 房间号如果为null 跳过 | 36 | // 房间号如果为null 跳过 | 
| @@ -53,6 +53,8 @@ public class LocationServiceImp implements LocationService { | @@ -53,6 +53,8 @@ public class LocationServiceImp implements LocationService { | ||
| 53 | distanceWaterMap.put("wmFmstate", realTime.getWmFmstate()); | 53 | distanceWaterMap.put("wmFmstate", realTime.getWmFmstate()); | 
| 54 | distanceWaterMap.put("wmLacc", realTime.getWmLacc()); | 54 | distanceWaterMap.put("wmLacc", realTime.getWmLacc()); | 
| 55 | distanceWaterMap.put("wmId", wmId); | 55 | distanceWaterMap.put("wmId", wmId); | 
| 56 | + distanceWaterMap.put("roomNumber", roomNumber); | ||
| 57 | + distanceWaterMap.put("userId", userId); | ||
| 56 | list.add(distanceWaterMap); | 58 | list.add(distanceWaterMap); | 
| 57 | } | 59 | } | 
| 58 | /** | 60 | /** | 
| @@ -66,6 +68,8 @@ public class LocationServiceImp implements LocationService { | @@ -66,6 +68,8 @@ public class LocationServiceImp implements LocationService { | ||
| 66 | eeMap.put("deviceId", energyInfoForRealTime.getDeviceId()); | 68 | eeMap.put("deviceId", energyInfoForRealTime.getDeviceId()); | 
| 67 | eeMap.put("balance", energyInfoForRealTime.getBalance()); | 69 | eeMap.put("balance", energyInfoForRealTime.getBalance()); | 
| 68 | eeMap.put("wmId", ""); | 70 | eeMap.put("wmId", ""); | 
| 71 | + eeMap.put("roomNumber", roomNumber); | ||
| 72 | + eeMap.put("userId", userId); | ||
| 69 | list.add(eeMap); | 73 | list.add(eeMap); | 
| 70 | } | 74 | } | 
| 71 | } | 75 | } | 
| @@ -89,7 +89,7 @@ public class PayOrderImpl implements PayOrderService { | @@ -89,7 +89,7 @@ public class PayOrderImpl implements PayOrderService { | ||
| 89 | * @throws Exception | 89 | * @throws Exception | 
| 90 | */ | 90 | */ | 
| 91 | @Override | 91 | @Override | 
| 92 | - @Scheduled(cron = "0 0 * * * ?") | 92 | +// @Scheduled(cron = "0 0 * * * ?") | 
| 93 | public void waterEleCount() throws Exception { | 93 | public void waterEleCount() throws Exception { | 
| 94 | Map<String, Object> map = new HashMap<>(); | 94 | Map<String, Object> map = new HashMap<>(); | 
| 95 | // 水量 | 95 | // 水量 | 
| @@ -4,7 +4,8 @@ | @@ -4,7 +4,8 @@ | ||
| 4 | "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> | 4 | "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> | 
| 5 | <generatorConfiguration> | 5 | <generatorConfiguration> | 
| 6 | <!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包--> | 6 | <!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包--> | 
| 7 | - <classPathEntry location="/Users/shenhailong/.m2/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar"/> | 7 | + <classPathEntry | 
| 8 | + location="/Users/shenhailong/.m2/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar"/> | ||
| 8 | <!--<classPathEntry location="/Users/mrz/Documents/maven/ojdbc6.jar"/>--> | 9 | <!--<classPathEntry location="/Users/mrz/Documents/maven/ojdbc6.jar"/>--> | 
| 9 | <context id="DB2Tables" targetRuntime="MyBatis3"> | 10 | <context id="DB2Tables" targetRuntime="MyBatis3"> | 
| 10 | <commentGenerator> | 11 | <commentGenerator> | 
| @@ -41,10 +42,13 @@ | @@ -41,10 +42,13 @@ | ||
| 41 | <property name="enableSubPackages" value="true"/> | 42 | <property name="enableSubPackages" value="true"/> | 
| 42 | </sqlMapGenerator> | 43 | </sqlMapGenerator> | 
| 43 | <!-- 生成DAO的包名和位置--> | 44 | <!-- 生成DAO的包名和位置--> | 
| 44 | - <javaClientGenerator type="XMLMAPPER" targetPackage="com.sunyo.energy.location.dao" targetProject="src/main/java"> | 45 | + <javaClientGenerator type="XMLMAPPER" targetPackage="com.sunyo.energy.location.dao" | 
| 46 | + targetProject="src/main/java"> | ||
| 45 | <property name="enableSubPackages" value="true"/> | 47 | <property name="enableSubPackages" value="true"/> | 
| 46 | </javaClientGenerator> | 48 | </javaClientGenerator> | 
| 47 | <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> | 49 | <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> | 
| 48 | - <table tableName="pay_response" domainObjectName="PayResponse" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="true"></table> | 50 | + <table tableName="users" domainObjectName="Users" enableCountByExample="false" | 
| 51 | + enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" | ||
| 52 | + selectByExampleQueryId="true"></table> | ||
| 49 | </context> | 53 | </context> | 
| 50 | </generatorConfiguration> | 54 | </generatorConfiguration> | 
| @@ -28,6 +28,13 @@ | @@ -28,6 +28,13 @@ | ||
| 28 | from users | 28 | from users | 
| 29 | where user_id = #{userId,jdbcType=INTEGER} | 29 | where user_id = #{userId,jdbcType=INTEGER} | 
| 30 | </select> | 30 | </select> | 
| 31 | + | ||
| 32 | + <select id="findRoomNumber" resultMap="BaseResultMap" parameterType="java.lang.String"> | ||
| 33 | + select | ||
| 34 | + <include refid="Base_Column_List"/> | ||
| 35 | + from users where mobilePhone = #{mobile, jdbcType=VARCHAR} order by creatTime desc limit 0,1 | ||
| 36 | + </select> | ||
| 37 | + | ||
| 31 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | 38 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | 
| 32 | delete from users | 39 | delete from users | 
| 33 | where user_id = #{userId,jdbcType=INTEGER} | 40 | where user_id = #{userId,jdbcType=INTEGER} | 
- 
请 注册 或 登录 后发表评论