修改流量方订单审核失败问题

This commit is contained in:
yuyang 2021-12-22 12:33:59 +08:00
parent a679213cdc
commit 88e762c926
8 changed files with 156 additions and 18 deletions

View File

@ -294,17 +294,18 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
xhpcChargeOrder.setAmountCharged(money);
Long userId = xhpcChargeOrder.getUserId();
Map<String, Object> userMessage = xhpcChargeOrderService.getUserMessage(userId);
if (userMessage == null || userMessage.get("balance") == null) {
//订单异常
xhpcChargeOrder.setStatus(2);
//异常原因
xhpcChargeOrder.setErroRemark("用户id:" + userId + "为空");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
return AjaxResult.error("用户id:" + userId + "为空");
if(xhpcChargeOrder.getInternetSerialNumber() ==null && xhpcChargeOrder.getStatus()==0){
if (userMessage == null || userMessage.get("balance") == null) {
//订单异常
xhpcChargeOrder.setStatus(2);
//异常原因
xhpcChargeOrder.setErroRemark("用户id:" + userId + "为空");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
return AjaxResult.error("用户id:" + userId + "为空");
}
}
//生成一条历史订单
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
xhpcHistoryOrder.setEndTime(xhpcChargeOrder.getEndTime());
xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc());
xhpcHistoryOrder.setEndSoc(xhpcChargeOrder.getEndSoc());

View File

@ -56,6 +56,23 @@ public class XhpcCommunityController extends BaseController {
return AjaxResult.success();
}
/**
* 查询社区组
*/
@PostMapping(value = "/getCommunityById")
public AjaxResult getCommunityById(@RequestBody XhpcCommunity xhpcCommunity) {
return AjaxResult.success(xhpcCommunityService.getCommunityById(xhpcCommunity));
}
/**
* 编辑社区组树
*
* @return
*/
@PostMapping(value = "/updateCommunity")
public AjaxResult updateCommunity(@RequestBody XhpcCommunity xhpcCommunity) {
return xhpcCommunityService.updateCommunity(xhpcCommunity);
}
/**
* 数据维度
@ -64,7 +81,7 @@ public class XhpcCommunityController extends BaseController {
*/
@GetMapping(value = "/getMechanism")
public AjaxResult getMechanism(@RequestParam(value = "status")Integer status) {
List<MechanismDto> mechanismDtos = mechanismService.dataList(1L, status);
List<MechanismDto> mechanismDtos = mechanismService.dataList(status);
return AjaxResult.success(mechanismDtos);
}

View File

@ -33,6 +33,12 @@ public interface XhpcCommunityMapper {
*/
int addCommunity(XhpcCommunity xhpcCommunity);
/**
* 修改社区组
* @param xhpcCommunity
* @return
*/
int updateCommunity(XhpcCommunity xhpcCommunity);
/**
* 社区社区组
* @param communityId
@ -43,4 +49,14 @@ public interface XhpcCommunityMapper {
* 检查改组是否还存在社区人员
*/
int countCommunityPersonnel(@Param("communityId")Long communityId);
/**
* 查询社区组
* @param communityId 社区id
* @param name 名称
* @param type 1 表示已社区id进行查询 2 排查社区id查询
* @return
*/
Map<String, Object> getCommunityById(@Param("communityId")Long communityId,@Param("name")String name,@Param("type")Integer type);
}

View File

@ -14,8 +14,7 @@ public interface IMechanismService {
/**
* 用户拥有数据权限
*
* @param userId 用户id
* @return 结果
*/
public List<MechanismDto> dataList(Long userId, Integer status);
public List<MechanismDto> dataList(Integer status);
}

View File

@ -33,4 +33,19 @@ public interface IXhpcCommunityService {
* 删除社区组树
*/
void deleteCommunity(XhpcCommunity xhpcCommunity);
/**
* 编辑社区组树
*
* @param
* @return
*/
AjaxResult updateCommunity(XhpcCommunity xhpcCommunity);
/**
* 查询社区组
*
* @return
*/
Map<String, Object> getCommunityById(XhpcCommunity xhpcCommunity);
}

View File

@ -23,10 +23,9 @@ public class IMechanismServiceImpl implements IMechanismService {
@Autowired
private MechanismMapper mechanismMapper;
@Override
public List<MechanismDto> dataList(Long userId, Integer status) {
public List<MechanismDto> dataList(Integer status) {
//获取登陆用户
//Long logUserId = SecurityUtils.getUserId();
Long logUserId = 1L;
Long logUserId = SecurityUtils.getUserId();
int type =1;
//根据权限获取场站
if(logUserId !=1){

View File

@ -41,13 +41,21 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
@Override
public AjaxResult addCommunity(XhpcCommunity xhpcCommunity) {
//名称重复不能入库
Map<String, Object> communityById = xhpcCommunityMapper.getCommunityById(null, xhpcCommunity.getName(), null);
if(communityById !=null){
return AjaxResult.error("社区名称重复");
}
String chargingStationIds = xhpcCommunity.getChargingStationIds();
if("".equals(chargingStationIds) || chargingStationIds ==null){
xhpcCommunity.setStatus(0);
}else{
xhpcCommunity.setStatus(1);
}
xhpcCommunityMapper.addCommunity(xhpcCommunity);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
xhpcCommunityMapper.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),1);
xhpcCommunityMapper.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),0);
}
return AjaxResult.success();
}
@ -61,4 +69,31 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
}
}
}
@Override
public AjaxResult updateCommunity(XhpcCommunity xhpcCommunity) {
//名称重复不能入库
Map<String, Object> communityById = xhpcCommunityMapper.getCommunityById(xhpcCommunity.getCommunityId(), xhpcCommunity.getName(), 2);
if(communityById !=null){
return AjaxResult.error("社区名称重复");
}
String chargingStationIds = xhpcCommunity.getChargingStationIds();
if("".equals(chargingStationIds) || chargingStationIds ==null){
xhpcCommunity.setStatus(0);
}else{
xhpcCommunity.setStatus(1);
}
xhpcCommunityMapper.addCommunity(xhpcCommunity);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
xhpcCommunityMapper.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),0);
}
return AjaxResult.success();
}
@Override
public Map<String, Object> getCommunityById(XhpcCommunity xhpcCommunity) {
return xhpcCommunityMapper.getCommunityById(xhpcCommunity.getCommunityId(),null,1);
}
}

View File

@ -33,15 +33,16 @@
community_id as communityId,
name as name
from xhpc_community
where del_flag =1
where del_flag =0
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
</select>
<insert id="addMechanism">
<foreach collection="chargingStationIds" item="item" index="index" open="" close="" separator="">
insert into xhpc_mechanism (charging_station_id,mechanism_id,source) VALUE (#{item},#{mechanismId},#{source})
insert into xhpc_mechanism (charging_station_id,mechanism_id,source) VALUES
<foreach collection="chargingStationIds" item="item" open="(" separator="),(" close=")">
#{item},#{mechanismId},#{source}
</foreach>
</insert>
@ -72,6 +73,9 @@
<if test="null != dimension">
dimension,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
@ -116,6 +120,9 @@
<if test="null != dimension">
#{dimension},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
@ -137,6 +144,27 @@
</trim>
</insert>
<update id="updateCommunity" parameterType="com.xhpc.user.domain.XhpcCommunity" useGeneratedKeys="true" keyProperty="communityId">
update xhpc_community
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="servicePreferential != null">service_preferential = #{servicePreferential},</if>
<if test="minPeople != null">min_people = #{minPeople},</if>
<if test="contactName != null">contact_name = #{contactName},</if>
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
<if test="address != null">address = #{address},</if>
<if test="dimension != null">address = #{dimension},</if>
<if test="status != null">address = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where community_id=#{communityId}
</update>
<update id="deleteCommunity">
update xhpc_community set del_flag =1 where community_id=#{communityId}
</update>
@ -144,4 +172,32 @@
<select id="countCommunityPersonnel" resultType="java.lang.Integer">
select count (community_personnel_id) from xhpc_community_personnel where community_id=#{communityId} and del_flag=0
</select>
<select id="getCommunityById" resultType="map">
select
co.community_id as communityId,
co.name as name,
co.service_preferential as servicePreferential,
co.min_people as minPeople,
co.contact_name as contactName,
co.contact_phone as contactPhone,
co.address as address,
co.dimension as dimension,
co.status as status,
group_concat(me.charging_station_id) chargingStationIds
from xhpc_community co
left join xhpc_mechanism me on me.mechanism_id = co.community_id and me.source = 0
where 1=1
<if test="communityId !=null and type !=null and type==1">
and co.community_id=#{communityId}
</if>
<if test="communityId !=null and type !=null and type==2">
and co.community_id !=#{communityId}
</if>
<if test="name !=null">
and co.name =#{name}
</if>
limit 1
</select>
</mapper>