增加捐赠发票设置,活动修改

This commit is contained in:
yuyang 2022-10-12 15:18:22 +08:00
parent 32c39f54a5
commit d9bead72cf
14 changed files with 603 additions and 35 deletions

View File

@ -36,7 +36,9 @@ public class XhpcChargingStationApiController extends BaseController {
//@PreAuthorize(hasPermi = "system:station:list") //@PreAuthorize(hasPermi = "system:station:list")
@GetMapping("/getWXList") @GetMapping("/getWXList")
public TableDataInfo getWXList(String name, String serviceFacilities, Integer code, String longitude, String latitude,String tenantId) { public TableDataInfo getWXList(String name, String serviceFacilities, Integer code, String longitude, String latitude,String tenantId) {
System.out.println("========tenantId======="+tenantId);
System.out.println("========tenantId======="+tenantId);
System.out.println("========tenantId======="+tenantId);
startPage(); startPage();
List<Map<String, Object>> list = xhpcChargingStationService.getWXList(name, serviceFacilities, code, longitude, latitude,tenantId); List<Map<String, Object>> list = xhpcChargingStationService.getWXList(name, serviceFacilities, code, longitude, latitude,tenantId);
return getDataTable(list); return getDataTable(list);

View File

@ -792,6 +792,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
stringList = Arrays.asList(split); stringList = Arrays.asList(split);
} }
String date = DateUtil.formatTime(new Date()); String date = DateUtil.formatTime(new Date());
List<Map<String, Object>> list = xhpcChargingStationMapper.getWXList(name, stringList, code, longitude, latitude, 2,date,tenantId); List<Map<String, Object>> list = xhpcChargingStationMapper.getWXList(name, stringList, code, longitude, latitude, 2,date,tenantId);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {

View File

@ -160,14 +160,21 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
if (terminalSerialNumber.length() != 16 || !m.matches()) { if (terminalSerialNumber.length() != 16 || !m.matches()) {
return AjaxResult.error(1104, "无效的终端编号"); return AjaxResult.error(1104, "无效的终端编号");
} }
System.out.println("============tenantId================="+tenantId);
System.out.println("============tenantId================="+tenantId);
System.out.println("============tenantId================="+tenantId);
//终端信息 //终端信息
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber,tenantId); XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber,tenantId);
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) { if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
String pilePrompt = redisService.getCacheObject("pilePrompt:"+tenantId);
if(!"".equals(pilePrompt) && pilePrompt !=null){
return AjaxResult.error(1104, pilePrompt);
}
return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电"); return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电");
}else {
if(xhpcTerminal.getStatus()==1){
if(xhpcTerminal.getPrompt() !=null){
return AjaxResult.error(1104, xhpcTerminal.getPrompt());
}else{
return AjaxResult.error(1104, "桩已停用,请选择其他桩进行充电");
}
}
} }
//查看充电用户金额是否大于5元 //查看充电用户金额是否大于5元
//Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(userId); //Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(userId);
@ -344,11 +351,15 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
//终端信息 //终端信息
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,tenantId); XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,tenantId);
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) { if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
String pilePrompt = redisService.getCacheObject("pilePrompt:"+tenantId);
if(!"".equals(pilePrompt) && pilePrompt !=null){
return AjaxResult.error(1104, pilePrompt);
}
return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电"); return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电");
}else {
if(xhpcTerminal.getStatus()==1){
if(xhpcTerminal.getPrompt() !=null){
return AjaxResult.error(1104, xhpcTerminal.getPrompt());
}else{
return AjaxResult.error(1104, "桩已停用,请选择其他桩进行充电");
}
}
} }
//获取桩信息 //获取桩信息
@ -361,11 +372,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
//获取充电订单号 //获取充电订单号
XhpcChargeOrder order = xhpcChargeOrderMapper.getChargingOrderId(chargingOrderId); XhpcChargeOrder order = xhpcChargeOrderMapper.getChargingOrderId(chargingOrderId);
if(order ==null){ if(order ==null){
String pilePrompt = redisService.getCacheObject("pilePrompt:"+tenantId); return AjaxResult.error(1104, "未获取到充电订单,拨打客服电话或按急停按钮停止充电");
if(!"".equals(pilePrompt) && pilePrompt !=null){
return AjaxResult.error(1104, pilePrompt);
}
return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电");
}else{ }else{
if(order.getSource()==1){ if(order.getSource()==1){
return AjaxResult.error(1104, "请在启动方停止充电"); return AjaxResult.error(1104, "请在启动方停止充电");
@ -518,6 +525,15 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
// } // }
r.setMsg("因限电该桩已停用请选择其他桩进行充电"); r.setMsg("因限电该桩已停用请选择其他桩进行充电");
return r; return r;
}else {
if(xhpcTerminal.getStatus()==1){
if(xhpcTerminal.getPrompt() !=null){
r.setMsg(xhpcTerminal.getPrompt());
}else{
r.setMsg("桩已停用,请选择其他桩进行充电");
}
return r;
}
} }
//终端状态是否空闲 //终端状态是否空闲
//是否插枪 //是否插枪
@ -738,6 +754,13 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber, tenantId); XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber, tenantId);
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) { if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
return R.fail(1104, "无效的终端编号"); return R.fail(1104, "无效的终端编号");
}else{
if(xhpcTerminal.getStatus()==1){
if(xhpcTerminal.getPrompt() !=null){
return R.fail(1104, xhpcTerminal.getPrompt());
}
return R.fail(1104, "无效的终端编号");
}
} }
Map<String, Object> xhpcChargingPileById = Map<String, Object> xhpcChargingPileById =
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(), tenantId); xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(), tenantId);
@ -863,7 +886,6 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
@Override @Override
public R pileVin(String serialNumber, String vinNumber) { public R pileVin(String serialNumber, String vinNumber) {
try{ try{
if("".equals(vinNumber) || vinNumber ==null ){ if("".equals(vinNumber) || vinNumber ==null ){
return R.fail(1888, "VIN码为空"); return R.fail(1888, "VIN码为空");
@ -874,7 +896,19 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
//Vin码表获取 用户id,用户类型 //Vin码表获取 用户id,用户类型
Long userId = 1L; Long userId = 1L;
Integer userType = 0; Integer userType = 0;
//终端信息
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,null); XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,null);
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
return R.fail(1104, "因限电该桩已停用,请选择其他桩进行充电");
}else {
if(xhpcTerminal.getStatus()==1){
if(xhpcTerminal.getPrompt() !=null){
return R.fail(1104, xhpcTerminal.getPrompt());
}else{
return R.fail(1104, "桩已停用,请选择其他桩进行充电");
}
}
}
String tenantId = xhpcTerminal.getTenantId(); String tenantId = xhpcTerminal.getTenantId();
long l1 = System.currentTimeMillis(); long l1 = System.currentTimeMillis();
R user = userTypeService.getUser(null, userId, userType, vinNumber,tenantId); R user = userTypeService.getUser(null, userId, userType, vinNumber,tenantId);
@ -892,14 +926,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
if (serialNumber.length() != 16 || !m.matches()) { if (serialNumber.length() != 16 || !m.matches()) {
return R.fail(1104, "无效的终端编号"); return R.fail(1104, "无效的终端编号");
} }
//终端信息
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
String pilePrompt = redisService.getCacheObject("pilePrompt:"+tenantId);
if(!"".equals(pilePrompt) && pilePrompt !=null){
return R.fail(1104, pilePrompt);
}
return R.fail(1104, "因限电该桩已停用,请选择其他桩进行充电");
}
//查看充电用户金额是否大于5元 //查看充电用户金额是否大于5元
//Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(userId); //Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(userId);
BigDecimal a = new BigDecimal(5); BigDecimal a = new BigDecimal(5);

View File

@ -161,21 +161,17 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
String chargingStationId = map1.get("chargingStationId").toString(); String chargingStationId = map1.get("chargingStationId").toString();
if(cachePile==null || cachePile.get("firmwareVersion")==null){ if(cachePile==null || cachePile.get("firmwareVersion")==null){
R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber); R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber);
System.out.println("============r===================="+r.getCode());
}else{ }else{
String firmwareVersion = cachePile.get("firmwareVersion").toString(); String firmwareVersion = cachePile.get("firmwareVersion").toString();
System.out.println("============firmwareVersion===================="+firmwareVersion);
if(type==1){ if(type==1){
if(!directNumber.equals(firmwareVersion)){ if(!directNumber.equals(firmwareVersion)){
//添加一条工单 //添加一条工单
R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber); R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber);
System.out.println("============r===================="+r.getCode());
} }
}else{ }else{
if(!communicationNumber.equals(firmwareVersion)){ if(!communicationNumber.equals(firmwareVersion)){
//添加一条工单 //添加一条工单
R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber); R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber);
System.out.println("============r===================="+r.getCode());
} }
} }
} }
@ -230,13 +226,11 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
Map<String, Object> cachePile = redisService.getCacheMap("pile:" + serialNumber); Map<String, Object> cachePile = redisService.getCacheMap("pile:" + serialNumber);
if(cachePile==null || cachePile.get("rateModelId") ==null){ if(cachePile==null || cachePile.get("rateModelId") ==null){
R r = workOrderService.addNewOrder("14","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber); R r = workOrderService.addNewOrder("14","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber);
System.out.println("============r===================="+r.getCode());
}else{ }else{
String rateModelId = cachePile.get("rateModelId").toString(); String rateModelId = cachePile.get("rateModelId").toString();
System.out.println("============rateModelId===================="+rateModelId); System.out.println("============rateModelId===================="+rateModelId);
if(!modelId.equals(rateModelId)){ if(!modelId.equals(rateModelId)){
R r = workOrderService.addNewOrder("14","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber); R r = workOrderService.addNewOrder("14","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber);
System.out.println("============r===================="+r.getCode());
} }
} }
} }

View File

@ -167,7 +167,7 @@
<if test="tenantId !=null and ''!=tenantId"> <if test="tenantId !=null and ''!=tenantId">
and tenant_id=#{tenantId} and tenant_id=#{tenantId}
</if> </if>
and del_flag=0 and status=0 limit 1 and del_flag=0 limit 1
</select> </select>
<insert id="addXhpcChargeOrder" parameterType="com.xhpc.order.domain.XhpcChargeOrder" useGeneratedKeys="true" <insert id="addXhpcChargeOrder" parameterType="com.xhpc.order.domain.XhpcChargeOrder" useGeneratedKeys="true"

View File

@ -0,0 +1,57 @@
package com.xhpc.user.controller;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.system.api.model.LoginUser;
import com.xhpc.user.domain.XhpcDonationInvoice;
import com.xhpc.user.service.IXhpcDonationInvoiceService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* @author yuyang
* @date 2022/6/22 14:03
*/
@RestController
@RequestMapping("/donationInvoice")
public class XhpcDonationInvoiceController extends BaseController {
@Resource
IXhpcDonationInvoiceService xhpcDonationInvoiceService;
@Resource
LogUserUtils logUserUtils;
@PostMapping("/addOrUpdate")
public AjaxResult insertDonationInvoice(@RequestBody XhpcDonationInvoice xhpcDonationInvoice) {
return xhpcDonationInvoiceService.insertDonationInvoice(xhpcDonationInvoice);
}
@GetMapping("/getDonationInvoiceById")
public AjaxResult getDonationInvoiceById(Long donationInvoiceId) {
return xhpcDonationInvoiceService.getDonationInvoiceById(donationInvoiceId);
}
@GetMapping("/list")
public TableDataInfo list(HttpServletRequest request, String name, String titleContent, String dutyNumber) {
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
params.put("titleContent", titleContent);
params.put("dutyNumber", dutyNumber);
params.put("name", name);
return getDataTable(xhpcDonationInvoiceService.getPage(params));
}
@GetMapping("/deleteById")
public AjaxResult deleteById(String donationInvoiceId) {
return xhpcDonationInvoiceService.deleteById(donationInvoiceId);
}
}

View File

@ -0,0 +1,84 @@
package com.xhpc.user.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 捐赠发票
* @author yuyang
* @date 2022/6/22 11:21
*/
@Data
public class XhpcDonationInvoice extends BaseEntity {
private Long donationInvoiceId;
/**
* 捐赠单位名称
*/
private String name;
/**
* 发票类型(默认0普票1为专票)
*/
private Integer invoiceType;
/**
* 接收邮箱
*/
private String receiveEmail;
/**
* 0为企业抬头 1为非企业抬头
*/
private Integer titleType;
/**
* 发票抬头
*/
private String titleContent;
/**
* 税号
*/
private String dutyNumber;
/**
* 发票内容
*/
private String invoiceContent;
/**
* 所开发票是否展示交易记录0为不展示1为展示
*/
private Integer isShowDate;
/**
* 公司地址
*/
private String firmAddress;
/**
* 公司电话
*/
private String firmPhone;
/**
* 公司开户行
*/
private String firmBank;
/**
* 公司开户行账号
*/
private String firmBankAccount;
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
private String tenantId;
}

View File

@ -53,7 +53,7 @@ public interface MechanismMapper {
* 通过登录用户分组查询场站 * 通过登录用户分组查询场站
* @return 结果 * @return 结果
*/ */
public List<Map<String, Object>> dataChargingStationId(@Param("userId") Long userId, @Param("type") Integer type,@Param("operatorId") String operatorId,@Param("code") String cityCode); public List<Map<String, Object>> dataChargingStationId(@Param("userId") Long userId, @Param("type") Integer type,@Param("operatorId") String operatorId,@Param("code") String cityCode,@Param("tenantId") String tenantId);
/** /**

View File

@ -0,0 +1,28 @@
package com.xhpc.user.mapper;
import com.xhpc.user.domain.XhpcDonationInvoice;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @date 2022/6/22 11:48
*/
public interface XhpcDonationInvoiceMapper {
int insertDonationInvoice(XhpcDonationInvoice xhpcDonationInvoice);
int updateDonationInvoice(XhpcDonationInvoice xhpcDonationInvoice);
//查询重复信息
List<XhpcDonationInvoice> getDonationInvoiceMessage(@Param("params") Map<String, Object> params);
int getDonationInvoiceRepeat(@Param("donationInvoiceId") Long donationInvoiceId,@Param("name") String name,@Param("titleContent") String titleContent,@Param("dutyNumber") String dutyNumber,@Param("tenantId") String tenantId);
XhpcDonationInvoice getDonationInvoiceById(@Param("donationInvoiceId") Long donationInvoiceId,@Param("tenantId") String tenantId);
int updateDonationInvoiceById(@Param("donationInvoiceId") Long donationInvoiceId,@Param("tenantId") String tenantId);
}

View File

@ -0,0 +1,29 @@
package com.xhpc.user.service;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.user.domain.XhpcDonationInvoice;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @date 2022/6/22 11:47
*/
public interface IXhpcDonationInvoiceService {
/**
* 添加捐款发票企业
* @param xhpcDonationInvoice
* @return
*/
AjaxResult insertDonationInvoice(XhpcDonationInvoice xhpcDonationInvoice);
AjaxResult getDonationInvoiceById(Long donationInvoiceId);
List<XhpcDonationInvoice> getPage(Map<String, Object> params);
AjaxResult deleteById(String donationInvoiceId);
}

View File

@ -156,7 +156,7 @@ public class IMechanismServiceImpl implements IMechanismService {
mechanismOperator.setLabel(operatorMap.get("name").toString()); mechanismOperator.setLabel(operatorMap.get("name").toString());
List<MechanismDto> mechanismdataList =new ArrayList<>(); List<MechanismDto> mechanismdataList =new ArrayList<>();
//场站 //场站
List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,codeArea); List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,codeArea,tenantId);
for (Map<String, Object> dataMap:dataList) { for (Map<String, Object> dataMap:dataList) {
MechanismDto mechanismData =new MechanismDto(); MechanismDto mechanismData =new MechanismDto();
String codeData = dataMap.get("chargingStationId").toString(); String codeData = dataMap.get("chargingStationId").toString();
@ -194,7 +194,7 @@ public class IMechanismServiceImpl implements IMechanismService {
mechanismOperator.setLabel(operatorMap.get("name").toString()); mechanismOperator.setLabel(operatorMap.get("name").toString());
List<MechanismDto> mechanismdataList =new ArrayList<>(); List<MechanismDto> mechanismdataList =new ArrayList<>();
//场站 //场站
List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,null); List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,null,tenantId);
for (Map<String, Object> dataMap:dataList) { for (Map<String, Object> dataMap:dataList) {
MechanismDto mechanismData =new MechanismDto(); MechanismDto mechanismData =new MechanismDto();
String codeData = dataMap.get("chargingStationId").toString(); String codeData = dataMap.get("chargingStationId").toString();
@ -251,7 +251,7 @@ public class IMechanismServiceImpl implements IMechanismService {
mechanismArea.setLabel(areaMap.get("name").toString()); mechanismArea.setLabel(areaMap.get("name").toString());
List<MechanismDto> mechanismOperatorList =new ArrayList<>(); List<MechanismDto> mechanismOperatorList =new ArrayList<>();
//场站 //场站
List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,codeArea); List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,codeArea,tenantId);
for (Map<String, Object> dataMap:dataList) { for (Map<String, Object> dataMap:dataList) {
MechanismDto mechanismData =new MechanismDto(); MechanismDto mechanismData =new MechanismDto();
String codeData = dataMap.get("chargingStationId").toString(); String codeData = dataMap.get("chargingStationId").toString();
@ -302,7 +302,7 @@ public class IMechanismServiceImpl implements IMechanismService {
mechanismOperator.setLabel(operatorMap.get("name").toString()); mechanismOperator.setLabel(operatorMap.get("name").toString());
List<MechanismDto> mechanismdataList =new ArrayList<>(); List<MechanismDto> mechanismdataList =new ArrayList<>();
//场站 //场站
List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,null); List<Map<String, Object>> dataList = mechanismMapper.dataChargingStationId(userId, type, operatorId,null,tenantId);
for (Map<String, Object> dataMap:dataList) { for (Map<String, Object> dataMap:dataList) {
MechanismDto mechanismData =new MechanismDto(); MechanismDto mechanismData =new MechanismDto();
String codeData = dataMap.get("chargingStationId").toString(); String codeData = dataMap.get("chargingStationId").toString();

View File

@ -0,0 +1,107 @@
package com.xhpc.user.service.impl;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.system.api.model.LoginUser;
import com.xhpc.user.domain.XhpcDonationInvoice;
import com.xhpc.user.mapper.XhpcDonationInvoiceMapper;
import com.xhpc.user.service.IXhpcDonationInvoiceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @date 2022/6/22 11:47
*/
@Service
public class XhpcDonationInvoiceImpl implements IXhpcDonationInvoiceService {
@Resource
XhpcDonationInvoiceMapper xhpcDonationInvoiceMapper;
@Resource
TokenService tokenService;
/**
* 添加捐款发票企业
*
* @param xhpcDonationInvoice
* @return
*/
@Override
public AjaxResult insertDonationInvoice(XhpcDonationInvoice xhpcDonationInvoice) {
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
//名称不能重复\发票抬头不能重复\发票税号不能重复
if(xhpcDonationInvoice.getDonationInvoiceId() ==null){
String name = xhpcDonationInvoice.getName();
if(name !=null){
int i = xhpcDonationInvoiceMapper.getDonationInvoiceRepeat(null, name, null, null, tenantId);
if(i>0){
return AjaxResult.error(500, "捐款单位名称重复");
}
}
String titleContent = xhpcDonationInvoice.getTitleContent();
if(titleContent !=null){
int i = xhpcDonationInvoiceMapper.getDonationInvoiceRepeat(null, null, titleContent, null, tenantId);
if(i>0){
return AjaxResult.error(500, "发票抬头重复");
}
}
String dutyNumber = xhpcDonationInvoice.getDutyNumber();
if(dutyNumber !=null){
int i = xhpcDonationInvoiceMapper.getDonationInvoiceRepeat(null, null, null, dutyNumber, tenantId);
if(i>0){
return AjaxResult.error(500, "发票税号重复");
}
}
xhpcDonationInvoiceMapper.insertDonationInvoice(xhpcDonationInvoice);
return AjaxResult.success();
}else{
Long donationInvoiceId = xhpcDonationInvoice.getDonationInvoiceId();
String name = xhpcDonationInvoice.getName();
if(name !=null){
int i = xhpcDonationInvoiceMapper.getDonationInvoiceRepeat(donationInvoiceId, name, null, null, tenantId);
if(i>0){
return AjaxResult.error(500, "捐款单位名称重复");
}
}
String titleContent = xhpcDonationInvoice.getTitleContent();
if(titleContent !=null){
int i = xhpcDonationInvoiceMapper.getDonationInvoiceRepeat(donationInvoiceId, null, titleContent, null, tenantId);
if(i>0){
return AjaxResult.error(500, "发票抬头重复");
}
}
String dutyNumber = xhpcDonationInvoice.getDutyNumber();
if(dutyNumber !=null){
int i = xhpcDonationInvoiceMapper.getDonationInvoiceRepeat(donationInvoiceId, null, null, dutyNumber, tenantId);
if(i>0){
return AjaxResult.error(500, "发票税号重复");
}
}
xhpcDonationInvoiceMapper.updateDonationInvoice(xhpcDonationInvoice);
return AjaxResult.success();
}
}
@Override
public AjaxResult getDonationInvoiceById(Long donationInvoiceId) {
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
return AjaxResult.success(xhpcDonationInvoiceMapper.getDonationInvoiceById(donationInvoiceId,tenantId));
}
@Override
public AjaxResult deleteById(String donationInvoiceId) {
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
return AjaxResult.success(xhpcDonationInvoiceMapper.updateDonationInvoiceById(Long.parseLong(donationInvoiceId),tenantId));
}
@Override
public List<XhpcDonationInvoice> getPage(Map<String, Object> params) {
return xhpcDonationInvoiceMapper.getDonationInvoiceMessage(params);
}
}

View File

@ -130,6 +130,9 @@
<if test="null != code and '' != code"> <if test="null != code and '' != code">
and xcs.area_code = #{code} and xcs.area_code = #{code}
</if> </if>
<if test="null != tenantId and '' != tenantId">
and xcs.tenant_id = #{tenantId}
</if>
</select> </select>
<update id="updateMechanism"> <update id="updateMechanism">

View File

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.user.mapper.XhpcDonationInvoiceMapper">
<resultMap id="BaseResultMap" type="com.xhpc.user.domain.XhpcDonationInvoice">
<id column="donation_invoice_id" jdbcType="BIGINT" property="donationInvoiceId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="invoice_type" jdbcType="INTEGER" property="invoiceType"/>
<result column="receive_email" jdbcType="VARCHAR" property="receiveEmail"/>
<result column="title_type" jdbcType="INTEGER" property="titleType"/>
<result column="title_content" jdbcType="VARCHAR" property="titleContent"/>
<result column="duty_number" jdbcType="VARCHAR" property="dutyNumber"/>
<result column="invoice_content" jdbcType="VARCHAR" property="invoiceContent"/>
<result column="firm_address" jdbcType="VARCHAR" property="firmAddress"/>
<result column="firm_phone" jdbcType="VARCHAR" property="firmPhone"/>
<result column="firm_bank" jdbcType="VARCHAR" property="firmBank"/>
<result column="firm_bank_account" jdbcType="VARCHAR" property="firmBankAccount"/>
<result column="is_show_date" jdbcType="INTEGER" property="isShowDate"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="update_time" jdbcType="DATE" property="updateTime"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
</resultMap>
<sql id="Base_Column_List">
donation_invoice_id, name, invoice_type, receive_email, title_type, title_content, duty_number, invoice_content, firm_address, firm_phone, firm_bank,
firm_bank_account,is_show_date,tenant_id, `status`, del_flag, create_by, create_time, update_by, update_time
</sql>
<insert id="insertDonationInvoice" parameterType="com.xhpc.user.domain.XhpcDonationInvoice" useGeneratedKeys="true" keyProperty="donationInvoiceId">
insert into xhpc_donation_invoice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != name and ''!=name ">
name,
</if>
<if test="null != invoiceType ">
invoice_type,
</if>
<if test="null != receiveEmail and ''!=receiveEmail ">
receive_email,
</if>
<if test="null != titleType ">
title_type,
</if>
<if test="null != titleContent and ''!=titleContent ">
title_content,
</if>
<if test="null != dutyNumber and ''!=dutyNumber ">
duty_number,
</if>
<if test="null != invoiceContent and ''!=invoiceContent ">
invoice_content,
</if>
<if test="null != firmAddress and ''!=firmAddress ">
firm_address,
</if>
<if test="null != firmPhone and ''!=firmPhone ">
firm_phone,
</if>
<if test="null != firmBank and ''!=firmBank ">
firm_bank,
</if>
<if test="null != firmBankAccount and ''!=firmBankAccount ">
firm_bank_account,
</if>
<if test="null != isShowDate ">
is_show_date,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != status ">
status,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != tenantId and '' != tenantId">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != name and ''!=name ">
#{name},
</if>
<if test="null != invoiceType ">
#{invoiceType},
</if>
<if test="null != receiveEmail and ''!=receiveEmail ">
#{receiveEmail},
</if>
<if test="null != titleType ">
#{titleType},
</if>
<if test="null != titleContent and ''!=titleContent ">
#{titleContent},
</if>
<if test="null != dutyNumber and ''!=dutyNumber ">
#{dutyNumber},
</if>
<if test="null != invoiceContent and ''!=invoiceContent ">
#{invoiceContent},
</if>
<if test="null != firmAddress and ''!=firmAddress ">
#{firmAddress},
</if>
<if test="null != firmPhone and ''!=firmPhone ">
#{firmPhone},
</if>
<if test="null != firmBank and ''!=firmBank ">
#{firmBank},
</if>
<if test="null != firmBankAccount and ''!=firmBankAccount ">
#{firmBankAccount},
</if>
<if test="null != isShowDate ">
#{isShowDate},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != tenantId and '' != tenantId">
#{tenantId},
</if>
</trim>
</insert>
<update id="updateDonationInvoice" parameterType="Integer">
update xhpc_donation_invoice
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="invoiceType != null">invoice_type = #{invoiceType},</if>
<if test="receiveEmail != null">receive_email = #{receiveEmail},</if>
<if test="titleType != null">title_type = #{titleType},</if>
<if test="titleContent != null">title_content = #{titleContent},</if>
<if test="dutyNumber != null">duty_number = #{dutyNumber},</if>
<if test="invoiceContent != null">invoice_content = #{invoiceContent},</if>
<if test="firmAddress != null">firm_address = #{firmAddress},</if>
<if test="firmPhone != null">firm_phone = #{firmPhone},</if>
<if test="firmBank != null">firm_bank = #{firmBank},</if>
<if test="firmBankAccount != null">firm_bank_account = #{firmBankAccount},</if>
<if test="isShowDate != null">is_show_date = #{isShowDate},</if>
<if test="status != null">status = #{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="tenantId != null">tenant_id = #{tenantId},</if>
</trim>
where donation_invoice_id = #{donationInvoiceId}
</update>
<select id="getDonationInvoiceMessage" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_donation_invoice
where del_flag =0
<if test="params.name !=null and ''!=params.name">
and name like concat('%', #{params.name}, '%')
</if>
<if test="params.titleContent !=null and ''!=params.titleContent">
and title_content like concat('%', #{params.titleContent}, '%')
</if>
<if test="params.dutyNumber !=null and ''!=params.dutyNumber">
and duty_number like concat('%', #{params.dutyNumber}, '%')
</if>
<if test="params.tenantId !=null and ''!=params.tenantId">
and tenant_id =#{params.tenantId}
</if>
</select>
<select id="getDonationInvoiceRepeat" resultType="int">
select count(donation_invoice_id) from xhpc_donation_invoice
where 1=1
<if test="donationInvoiceId !=null">
and donation_invoice_id != #{donationInvoiceId}
</if>
<if test="name !=null and ''!=name">
and name =#{name}
</if>
<if test="titleContent !=null and ''!=titleContent">
and title_content =#{titleContent}
</if>
<if test="dutyNumber !=null and ''!=dutyNumber">
and duty_number =#{dutyNumber}
</if>
<if test="tenantId !=null and ''!=tenantId">
and tenant_id =#{tenantId}
</if>
</select>
<select id="getDonationInvoiceById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_donation_invoice
where 1=1
<if test="donationInvoiceId !=null">
and donation_invoice_id = #{donationInvoiceId}
</if>
<if test="tenantId !=null and ''!=tenantId">
and tenant_id =#{tenantId}
</if>
limit 1
</select>
<update id="updateDonationInvoiceById">
update xhpc_donation_invoice set del_flag =2 where donation_invoice_id = #{donationInvoiceId} and tenant_id =#{tenantId}
</update>
</mapper>