diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/QrImgUtils.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/QrImgUtils.java index 2cbc75c7..09493e72 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/QrImgUtils.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/QrImgUtils.java @@ -33,27 +33,27 @@ public class QrImgUtils { //2.1生成指定规则的图片名 String qrFileName = DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + serialNumber + ".png"; //2.2获取生成的二维码图片 - File QrCode = QRCodeUtil.encode(QrContent, environment.getProperty("oss.imgPath"), environment.getProperty("oss.destPath"), true, qrFileName); + File QrCode = QRCodeUtil.encode(QrContent, environment.getProperty("imgPath"), environment.getProperty("oss.destPath"), true, qrFileName); //3.拼接成完整图片 //3.1生成指定规则的图片名 String finallyImgFileName = DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + serialNumber + ".png"; new ImageUtil().fastCreateImg( - new File(environment.getProperty("oss.bottomImg")), + new File(environment.getProperty("bottomImg")), QrCode, serialNumber, chargingStationName, name, String.valueOf(letterMap.get(forIndex)), - new File(environment.getProperty("oss.fullImgDestPath")+finallyImgFileName) + new File(environment.getProperty("fullImgDestPath")+finallyImgFileName) ); //4.上传图片至服务器 // 创建OSSClient实例 OSSClient ossClient = new OSSClient(environment.getProperty("oss.endpoint"), environment.getProperty("oss.access-key"), environment.getProperty("oss.secret-key")); // 上传文件流 - ossClient.putObject(environment.getProperty("oss.bucket-name"), xhpcTerminal.getPileSerialNumber() + "/" + finallyImgFileName, new File(environment.getProperty("oss.destPath") + "\\" + finallyImgFileName)); + ossClient.putObject(environment.getProperty("oss.bucket-name"), xhpcTerminal.getPileSerialNumber() + "/" + finallyImgFileName, new File(environment.getProperty("destPath") +finallyImgFileName)); ossClient.shutdown(); //5.将放在阿里云上的生成的图片的路径和图片所对应的终端的id放入数据库xhpc_img表中 @@ -61,10 +61,10 @@ public class QrImgUtils { xhpcImgMapper.insert(xhpcTerminal.getPileSerialNumber() + "/" + finallyImgFileName, terminalId); //6.删除生成的二维码图片 - File QrImg = new File(environment.getProperty("oss.destPath") + "\\" + qrFileName); + File QrImg = new File(environment.getProperty("destPath") + qrFileName); QrImg.delete(); //7.删除生成本地生成的完整图片 - File finallyImg = new File(environment.getProperty("oss.fullImgDestPath") + finallyImgFileName); + File finallyImg = new File(environment.getProperty("fullImgDestPath") + finallyImgFileName); finallyImg.delete(); } catch (Exception e) { diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml index 0be558be..988b50b6 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml @@ -23,3 +23,13 @@ spring: # 共享配置 shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + + +#二维码Logo图片获取位置: +imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png" +#生成的二维码存放位置: +destPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/" +#生成的最终完整图片的存放位置: +fullImgDestPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/" +#底图图片存放位置: +bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png" \ No newline at end of file diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml index 6cc48ef5..ed706952 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml @@ -75,7 +75,7 @@ select cp.charging_pile_id as chargingPileId, cp.charging_station_id as chargingStationId, - cp.name as chargingPileName, + concat(cp.name,'号桩') as chargingPileName, st.name as chargingStationName, cp.serial_number as serialNumber, cp.brand_model as brandModel, diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index e062ad08..24115c97 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -158,11 +158,7 @@ public class XhpcHistoryOrderController extends BaseController { } //修改历史订单表状态 - XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); - xhpcHistoryOrder.setHistoryOrderId(xhpc.getHistoryOrderId()); - xhpcHistoryOrder.setState(type + 1); - xhpcHistoryOrderService.update(xhpcHistoryOrder); - + xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type + 1); } } } @@ -171,7 +167,7 @@ public class XhpcHistoryOrderController extends BaseController { * 小时统计 */ @GetMapping("/test") - @Scheduled(cron = "0 */1 * * * ?") + //@Scheduled(cron = "0 */1 * * * ?") public void test(){ //获取500条待统计历史订单 //跨时段,跨费率,计费模型 @@ -188,10 +184,13 @@ public class XhpcHistoryOrderController extends BaseController { Long terminalId = xhpc.getTerminalId(); Long historyOrderId = xhpc.getHistoryOrderId(); Date data = Calendar.getInstance().getTime(); + if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){ + break; + } - //小时多少度电 + //每分钟多少度电 BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,RoundingMode.HALF_UP); - BigDecimal multiply = v.divide(xhpc.getChargingDegree(),2,RoundingMode.HALF_UP); + BigDecimal multiply = xhpc.getChargingDegree().divide(v,2,RoundingMode.HALF_UP); //1时间没有跨天 DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd"); @@ -260,10 +259,7 @@ public class XhpcHistoryOrderController extends BaseController { } //修改状态 //修改历史订单表状态 - XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); - xhpcHistoryOrder.setHistoryOrderId(xhpc.getHistoryOrderId()); - xhpcHistoryOrder.setState(1); - xhpcHistoryOrderService.update(xhpcHistoryOrder); + xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1); } } } @@ -306,10 +302,7 @@ public class XhpcHistoryOrderController extends BaseController { //修改历史订单表状态 - XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); - xhpcHistoryOrder.setHistoryOrderId(xhpc.getHistoryOrderId()); - xhpcHistoryOrder.setState(type+1); - xhpcHistoryOrderService.update(xhpcHistoryOrder); + xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type+1); } } } @@ -534,14 +527,10 @@ public class XhpcHistoryOrderController extends BaseController { String dateStr1 = "02:00:00"; Date date1 = DateUtil.parse(dateStr1); - String dateStr2 = "23:59:59"; + String dateStr2 = "05:00:00"; Date date2 = DateUtil.parse(dateStr2); - //相差一个月,31天 - long betweenDay = DateUtil.between(date1, date2, DateUnit.MINUTE); + System.out.println(date2.getTime()-date1.getTime()); - System.out.println("betweenDay:"+betweenDay); - - //System.out.println(">>>>>"+DateUtil.format(Calendar.getInstance().getTime(), "yyyy-MM-dd HH:mm:ss")); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java index 97f18b14..ac30a7cd 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java @@ -100,4 +100,11 @@ public interface XhpcHistoryOrderMapper { * @return */ List getStatistisList(@Param("number")int number,@Param("state")int state); + + + /** + * 更新历史订单 + * + */ + void updateXhpcHistoryOrder(@Param("historyOrderId")Long historyOrderId,@Param("state")Integer state); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java index 93205aa0..7b5c431e 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java @@ -75,4 +75,11 @@ public interface IXhpcHistoryOrderService { */ List getStatistisList(int number,int state); + + /** + * 更新历史订单 + * + */ + void updateXhpcHistoryOrder(Long historyOrderId,Integer state); + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index 03df4725..42b18b39 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -82,6 +82,11 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { return xhpcHistoryOrderMapper.getStatistisList(number,state); } + @Override + public void updateXhpcHistoryOrder(Long historyOrderId, Integer state) { + xhpcHistoryOrderMapper.updateXhpcHistoryOrder(historyOrderId,state); + } + /** * 历史信息费率时段 */ diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 4504531a..f84ba307 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -743,4 +743,9 @@ where state = #{state} limit 0,#{number} + + + + update xhpc_history_order set state = #{state} where history_order_id=#{historyOrderId} + diff --git a/xhpc-modules/xhpc-user/pom.xml b/xhpc-modules/xhpc-user/pom.xml index 250ae1a1..fb9a0938 100644 --- a/xhpc-modules/xhpc-user/pom.xml +++ b/xhpc-modules/xhpc-user/pom.xml @@ -81,6 +81,13 @@ 3.0.0 compile + + + org.apache.shiro + shiro-core + 1.4.2 + + diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java index 59727b27..31c4f9f2 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcUserController.java @@ -13,6 +13,7 @@ import com.xhpc.system.api.domain.SysUser; import com.xhpc.user.service.IXhpcOperatorService; import com.xhpc.user.service.IXhpcUserService; import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -61,7 +62,7 @@ public class XhpcUserController extends BaseController { role.setRoleSort("1"); iXhpcUserService.insertRole(role); sysUser.setPhonenumber(sysUser.getUserName()); - sysUser.setDeptId(103l); + sysUser.setDeptId(103L); sysUser.setDataPowerType(StatusConstants.SON_POWER_TYPE); sysUser.setUserType(StatusConstants.SYSTEM_USER_TYPE); sysUser.setCreateBy(SecurityUtils.getUsername()); @@ -117,7 +118,7 @@ public class XhpcUserController extends BaseController { * 新增运营商用户 */ @ApiOperation("新增运营商用户") - @PreAuthorize(hasPermi = "user:operator:add") + @RequiresPermissions("user:operator:add") @PostMapping("/operator/add") public AjaxResult operatorAdd(@RequestBody SysUser sysUser) { if (null == sysUser.getOperatorId()) { @@ -132,7 +133,7 @@ public class XhpcUserController extends BaseController { role.setRoleSort("1"); iXhpcUserService.insertRole(role); sysUser.setPhonenumber(sysUser.getUserName()); - sysUser.setDeptId(103l); + sysUser.setDeptId(103L); sysUser.setDataPowerType(StatusConstants.SON_POWER_TYPE); sysUser.setUserType(StatusConstants.OPERATION_SON_USER_TYPE); sysUser.setCreateBy(SecurityUtils.getUsername()); @@ -148,7 +149,7 @@ public class XhpcUserController extends BaseController { * 修改运营商用户 */ @ApiOperation("修改运营商用户") - @PreAuthorize(hasPermi = "user:operator:edit") + @RequiresPermissions("user:operator:edit") @PostMapping("/operator/edit") public AjaxResult operatorEdit(@RequestBody SysUser sysUser) { if (null == sysUser.getUserId()) { diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java index b4b2dbaf..f47d8d26 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java @@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; +import java.util.Date; import java.util.List; import java.util.Map; @@ -131,6 +132,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { xhpcAppUser.setPhone(phone); String password = phone.substring(phone.length() - 6); xhpcAppUser.setPassword(SecurityUtils.encryptPassword(password)); + xhpcAppUser.setCreateTime(new Date()); xhpcAppUserMapper.insert(xhpcAppUser); redisService.deleteObject("pvToken:"+phone); return appLogin(phone, type, openid); diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml index 39674a0d..9dd38418 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml @@ -107,13 +107,13 @@ LEFT JOIN xhpc_operator xo on xo.operator_id = su.operator_id WHERE su.del_flag = 0 and user_type = '03' - and user_name like concat(concat('%', #{userName}), '%') + and su.user_name like concat(concat('%', #{userName}), '%') - and nick_name like concat(concat('%', #{nickName}), '%') + and su.nick_name like concat(concat('%', #{nickName}), '%') - and operator_id = #{operatorId} + and su.operator_id = #{operatorId} ORDER BY su.update_time DESC