优化运营商接口,二维码图片生成
This commit is contained in:
parent
af451a3888
commit
732e93ef11
@ -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) {
|
||||
|
||||
@ -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"
|
||||
@ -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,
|
||||
|
||||
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,4 +100,11 @@ public interface XhpcHistoryOrderMapper {
|
||||
* @return
|
||||
*/
|
||||
List<XhpcChargeHistoryOrder> getStatistisList(@Param("number")int number,@Param("state")int state);
|
||||
|
||||
|
||||
/**
|
||||
* 更新历史订单
|
||||
*
|
||||
*/
|
||||
void updateXhpcHistoryOrder(@Param("historyOrderId")Long historyOrderId,@Param("state")Integer state);
|
||||
}
|
||||
|
||||
@ -75,4 +75,11 @@ public interface IXhpcHistoryOrderService {
|
||||
*/
|
||||
List<XhpcChargeHistoryOrder> getStatistisList(int number,int state);
|
||||
|
||||
|
||||
/**
|
||||
* 更新历史订单
|
||||
*
|
||||
*/
|
||||
void updateXhpcHistoryOrder(Long historyOrderId,Integer state);
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史信息费率时段
|
||||
*/
|
||||
|
||||
@ -743,4 +743,9 @@
|
||||
where state = #{state}
|
||||
limit 0,#{number}
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateXhpcHistoryOrder">
|
||||
update xhpc_history_order set state = #{state} where history_order_id=#{historyOrderId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@ -81,6 +81,13 @@
|
||||
<version>3.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>1.4.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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'
|
||||
<if test="userName != null and userName != ''">
|
||||
and user_name like concat(concat('%', #{userName}), '%')
|
||||
and su.user_name like concat(concat('%', #{userName}), '%')
|
||||
</if>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
and nick_name like concat(concat('%', #{nickName}), '%')
|
||||
and su.nick_name like concat(concat('%', #{nickName}), '%')
|
||||
</if>
|
||||
<if test="operatorId != null and operatorId != ''">
|
||||
and operator_id = #{operatorId}
|
||||
and su.operator_id = #{operatorId}
|
||||
</if>
|
||||
ORDER BY su.update_time DESC
|
||||
</select>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user