bobol
10 months ago
59 changed files with 2772 additions and 174 deletions
@ -0,0 +1,35 @@ |
|||
package com.lzbi.common.config; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 微信配置 |
|||
*/ |
|||
@Data |
|||
@Component |
|||
@ConfigurationProperties(prefix = "wechat") |
|||
public class WechatConfig { |
|||
|
|||
/** |
|||
* 小程序 appId |
|||
*/ |
|||
private String appId; |
|||
/** |
|||
* 小程序 appSecret |
|||
*/ |
|||
private String appSecret; |
|||
/** |
|||
* 小程序登录接口 url |
|||
*/ |
|||
private String code2Session; |
|||
/** |
|||
* 获取接口调用凭据口 url |
|||
*/ |
|||
private String accessToken; |
|||
/** |
|||
* 获取手机号接口 url |
|||
*/ |
|||
private String phoneNumber; |
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.lzbi.common.constant; |
|||
|
|||
/** |
|||
* 业务常量 |
|||
*/ |
|||
public interface BizConstants { |
|||
|
|||
/** |
|||
* 指标类别 |
|||
*/ |
|||
interface TargetType { |
|||
/** |
|||
* 单日 |
|||
*/ |
|||
String DAY = "1"; |
|||
/** |
|||
* 累计 |
|||
*/ |
|||
String ACCUMULATIVE = "2"; |
|||
} |
|||
|
|||
/** |
|||
* 部门类别 |
|||
*/ |
|||
interface DcDeptAttr { |
|||
|
|||
/** |
|||
* 公司 |
|||
*/ |
|||
String COMANY = "1002"; |
|||
|
|||
/** |
|||
* 热源 |
|||
*/ |
|||
String HEAT_SOURCE = "1003"; |
|||
} |
|||
|
|||
/** |
|||
* 资产类别 |
|||
*/ |
|||
interface DcAssetAttr { |
|||
|
|||
/** |
|||
* 换热站 |
|||
*/ |
|||
String HEAT_EXCHANGE_STATION = "1001"; |
|||
|
|||
/** |
|||
* 热源 |
|||
*/ |
|||
String HEAT_SOURCE = "1002"; |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.lzbi.asset.domain; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class AssetParamsVO { |
|||
|
|||
private List<ElementTreeVO> treeData; |
|||
|
|||
private Map<String, List<ParamsPartitionVO>> paramsPartitionMap; |
|||
} |
@ -1,70 +1,85 @@ |
|||
package com.lzbi.asset.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.experimental.Accessors; |
|||
import com.lzbi.common.annotation.Excel; |
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
|
|||
/** |
|||
* 采集参数来源信息表; |
|||
* @author : zhousq |
|||
* @date : 2023-12-5 |
|||
* 采集参数来源信息对象 dc_busi_param_source |
|||
* |
|||
* @author win |
|||
* @date 2024-01-17 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@Accessors(chain = true) |
|||
@ApiModel(value = "采集参数来源信息表",description = "") |
|||
@TableName("dc_busi_param_source") |
|||
public class DcBusiParamSource extends BaseModuleEntity{ |
|||
public class DcBusiParamSource extends BaseModuleEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 参数编码 */ |
|||
@ApiModelProperty(name = "参数编码",notes = "") |
|||
private String paramCode ; |
|||
@Excel(name = "参数编码") |
|||
@ApiModelProperty(name = "参数编码",notes = "paramCode") |
|||
private String paramCode; |
|||
|
|||
/** 参数名称 */ |
|||
@ApiModelProperty(name = "参数名称",notes = "") |
|||
private String paramName ; |
|||
@Excel(name = "参数名称") |
|||
@ApiModelProperty(name = "参数名称",notes = "paramName") |
|||
private String paramName; |
|||
|
|||
/** 分组名称 */ |
|||
@ApiModelProperty(name = "分组名称",notes = "") |
|||
private String groupName ; |
|||
@Excel(name = "分组名称") |
|||
@ApiModelProperty(name = "分组名称",notes = "groupName") |
|||
private String groupName; |
|||
|
|||
/** 分组编码 */ |
|||
@ApiModelProperty(name = "分组编码",notes = "") |
|||
private String groupCode ; |
|||
@Excel(name = "分组编码") |
|||
@ApiModelProperty(name = "分组编码",notes = "groupCode") |
|||
private String groupCode; |
|||
|
|||
/** 资产编码(不是统计单元) */ |
|||
@Excel(name = "资产编码", readConverterExp = "不=是统计单元") |
|||
@ApiModelProperty(name = "资产编码",notes = "") |
|||
private String assetCode; |
|||
|
|||
/** 资产名称(不是统计单元) */ |
|||
@Excel(name = "资产名称", readConverterExp = "不=是统计单元") |
|||
@ApiModelProperty(name = "资产名称",notes = "") |
|||
private String assetName; |
|||
|
|||
/** 分区 */ |
|||
@Excel(name = "分区") |
|||
@ApiModelProperty(name = "分区",notes = "partion") |
|||
private String partion; |
|||
|
|||
/** 扩展属性 */ |
|||
@ApiModelProperty(name = "扩展属性",notes = "") |
|||
private String extPro ; |
|||
@Excel(name = "扩展属性") |
|||
@ApiModelProperty(name = "扩展属性",notes = "extPro") |
|||
private String extPro; |
|||
|
|||
/** 来源类型 */ |
|||
@ApiModelProperty(name = "来源类型",notes = "") |
|||
private String sourceType ; |
|||
@Excel(name = "来源类型") |
|||
@ApiModelProperty(name = "来源类型",notes = "sourceType") |
|||
private String sourceType; |
|||
|
|||
/** 是否有效 */ |
|||
@ApiModelProperty(name = "是否有效",notes = "") |
|||
private String enabledFlag ; |
|||
@Excel(name = "是否有效") |
|||
@ApiModelProperty(name = "是否有效",notes = "enabledFlag") |
|||
private String enabledFlag; |
|||
|
|||
/** 主键 */ |
|||
@ApiModelProperty(name = "主键",notes = "") |
|||
@TableId(type= IdType.AUTO) |
|||
private Long id ; |
|||
/** 所属专业 */ |
|||
@ApiModelProperty(name = "所属专业",notes = "") |
|||
private String fieldCode ; |
|||
/** 所属名称 */ |
|||
@ApiModelProperty(name = "所属名称",notes = "") |
|||
private String fieldName ; |
|||
private String value; |
|||
private String label; |
|||
private Long id; |
|||
|
|||
public String getValue() { |
|||
return this.paramCode; |
|||
} |
|||
/** 所属专业 */ |
|||
@Excel(name = "所属专业") |
|||
@ApiModelProperty(name = "所属专业",notes = "fieldCode") |
|||
private String fieldCode; |
|||
|
|||
/** 所属名称 */ |
|||
@Excel(name = "所属名称") |
|||
@ApiModelProperty(name = "所属名称",notes = "fieldName") |
|||
private String fieldName; |
|||
|
|||
public String getLabel() { |
|||
return this.paramCode; |
|||
} |
|||
} |
@ -0,0 +1,80 @@ |
|||
package com.lzbi.asset.domain; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* elementUI树形结构返回值 |
|||
*/ |
|||
public class ElementTreeVO { |
|||
|
|||
/** |
|||
* 值 |
|||
*/ |
|||
private Object value; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String label; |
|||
/** |
|||
* 是否禁用 |
|||
*/ |
|||
private boolean disabled; |
|||
/** |
|||
* 是否有下级节点 |
|||
*/ |
|||
private boolean isLeaf; |
|||
/** |
|||
* 下级节点 |
|||
*/ |
|||
private List<ElementTreeVO> children; |
|||
|
|||
private List<ElementTreeVO> data; |
|||
|
|||
public Object getValue() { |
|||
return value; |
|||
} |
|||
|
|||
public void setValue(Object value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public String getLabel() { |
|||
return label; |
|||
} |
|||
|
|||
public void setLabel(String label) { |
|||
this.label = label; |
|||
} |
|||
|
|||
public boolean getDisabled() { |
|||
return disabled; |
|||
} |
|||
|
|||
public void setDisabled(boolean disabled) { |
|||
this.disabled = disabled; |
|||
} |
|||
|
|||
public boolean getIsLeaf() { |
|||
return isLeaf; |
|||
} |
|||
|
|||
public void setIsLeaf(boolean leaf) { |
|||
isLeaf = leaf; |
|||
} |
|||
|
|||
public List<ElementTreeVO> getChildren() { |
|||
return children; |
|||
} |
|||
|
|||
public void setChildren(List<ElementTreeVO> children) { |
|||
this.children = children; |
|||
} |
|||
|
|||
public List<ElementTreeVO> getData() { |
|||
return data; |
|||
} |
|||
|
|||
public void setData(List<ElementTreeVO> data) { |
|||
this.data = data; |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.lzbi.asset.domain; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ParamsPartitionVO { |
|||
|
|||
/** |
|||
* 值 |
|||
*/ |
|||
private String paramsCode; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String paramsName; |
|||
|
|||
/** |
|||
* 分区 |
|||
*/ |
|||
private String partition; |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.lzbi.asset.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class TreeVO { |
|||
|
|||
private String value; |
|||
|
|||
private String label; |
|||
|
|||
private boolean disabled; |
|||
|
|||
private List<TreeVO> options; |
|||
} |
@ -0,0 +1,154 @@ |
|||
package com.lzbi.bill.controller; |
|||
import com.lzbi.draft.domain.req.ConfirmReq; |
|||
import com.lzbi.draft.domain.req.ProductionDailySheetReq; |
|||
import io.swagger.annotations.ApiImplicitParam; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.lzbi.common.annotation.Log; |
|||
import com.lzbi.common.core.controller.BaseController; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.enums.BusinessType; |
|||
import com.lzbi.bill.domain. DcBusiTargetInputMaster; |
|||
import com.lzbi.bill.service.DcBusiTargetInputMasterService; |
|||
import com.lzbi.common.utils.poi.ExcelUtil; |
|||
import com.lzbi.common.core.page.TableDataInfo; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
/** |
|||
* 指标录入单Controller |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/bill/DcBusiTargetInputMaster") |
|||
public class DcBusiTargetInputMasterController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private DcBusiTargetInputMasterService dcBusiTargetInputMasterService; |
|||
|
|||
/** |
|||
* 查询指标录入单列表 |
|||
*/ |
|||
@ApiOperation("查询指标录入单列表") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputMaster", value = "", dataType = "DcBusiTargetInputMaster", dataTypeClass = DcBusiTargetInputMaster.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputMaster:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcBusiTargetInputMaster DcBusiTargetInputMaster) |
|||
{ |
|||
startPage(); |
|||
List< DcBusiTargetInputMaster> list = dcBusiTargetInputMasterService.selectDcBusiTargetInputMasterList(DcBusiTargetInputMaster); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出指标录入单列表 |
|||
*/ |
|||
@ApiOperation("导出指标录入单列表") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputMaster", value = "", dataType = "DcBusiTargetInputMaster", dataTypeClass = DcBusiTargetInputMaster.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputMaster:export')") |
|||
@Log(title = "指标录入单", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response,DcBusiTargetInputMaster DcBusiTargetInputMaster) |
|||
{ |
|||
List<DcBusiTargetInputMaster> list = dcBusiTargetInputMasterService.selectDcBusiTargetInputMasterList(DcBusiTargetInputMaster); |
|||
ExcelUtil<DcBusiTargetInputMaster> util = new ExcelUtil<DcBusiTargetInputMaster>(DcBusiTargetInputMaster.class); |
|||
util.exportExcel(response, list, "指标录入单数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取指标录入单详细信息 |
|||
*/ |
|||
@ApiOperation("获取指标录入单详细信息") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputMaster:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return success(dcBusiTargetInputMasterService.selectDcBusiTargetInputMasterById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增指标录入单 |
|||
*/ |
|||
@ApiOperation("新增指标录入单") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputMaster", value = "", dataType = "DcBusiTargetInputMaster", dataTypeClass = DcBusiTargetInputMaster.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputMaster:add')") |
|||
@Log(title = "指标录入单", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcBusiTargetInputMaster DcBusiTargetInputMaster) |
|||
{ |
|||
return toAjax(dcBusiTargetInputMasterService.insertDcBusiTargetInputMaster(DcBusiTargetInputMaster)); |
|||
} |
|||
|
|||
/** |
|||
* 修改指标录入单 |
|||
*/ |
|||
|
|||
@ApiOperation("修改指标录入单") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputMaster", value = "", dataType = "DcBusiTargetInputMaster", dataTypeClass = DcBusiTargetInputMaster.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputMaster:edit')") |
|||
@Log(title = "指标录入单", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcBusiTargetInputMaster DcBusiTargetInputMaster) |
|||
{ |
|||
return toAjax(dcBusiTargetInputMasterService.updateDcBusiTargetInputMaster(DcBusiTargetInputMaster)); |
|||
} |
|||
|
|||
/** |
|||
* 删除指标录入单 |
|||
*/ |
|||
@ApiOperation("删除指标录入单") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "ids", value = "", dataType = "Long", dataTypeClass =Long.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputMaster:remove')") |
|||
@Log(title = "指标录入单", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcBusiTargetInputMasterService.deleteDcBusiTargetInputMasterByIds(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 上传生产日报 |
|||
* @param file |
|||
* @return |
|||
*/ |
|||
@PostMapping("/upload/production/daily") |
|||
public AjaxResult uploadProductionDaily(MultipartFile file) { |
|||
return dcBusiTargetInputMasterService.uploadProductionDaily(file); |
|||
} |
|||
|
|||
/** |
|||
* 确认日报数据 |
|||
* @param list |
|||
* @return |
|||
*/ |
|||
@PostMapping("/confirm") |
|||
public AjaxResult confirm(@RequestBody ConfirmReq confirmReq) { |
|||
return dcBusiTargetInputMasterService.confirm(confirmReq); |
|||
} |
|||
} |
@ -0,0 +1,131 @@ |
|||
package com.lzbi.bill.controller; |
|||
import io.swagger.annotations.ApiImplicitParam; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.lzbi.common.annotation.Log; |
|||
import com.lzbi.common.core.controller.BaseController; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.enums.BusinessType; |
|||
import com.lzbi.bill.domain. DcBusiTargetInputSub; |
|||
import com.lzbi.bill.service.DcBusiTargetInputSubService; |
|||
import com.lzbi.common.utils.poi.ExcelUtil; |
|||
import com.lzbi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 指标录入单子Controller |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/bill/DcBusiTargetInputSub") |
|||
public class DcBusiTargetInputSubController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private DcBusiTargetInputSubService dcBusiTargetInputSubService; |
|||
|
|||
/** |
|||
* 查询指标录入单子列表 |
|||
*/ |
|||
@ApiOperation("查询指标录入单子列表") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputSub", value = "", dataType = "DcBusiTargetInputSub", dataTypeClass = DcBusiTargetInputSub.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputSub:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcBusiTargetInputSub DcBusiTargetInputSub) |
|||
{ |
|||
startPage(); |
|||
List< DcBusiTargetInputSub> list = dcBusiTargetInputSubService.selectDcBusiTargetInputSubList(DcBusiTargetInputSub); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出指标录入单子列表 |
|||
*/ |
|||
@ApiOperation("导出指标录入单子列表") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputSub", value = "", dataType = "DcBusiTargetInputSub", dataTypeClass = DcBusiTargetInputSub.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputSub:export')") |
|||
@Log(title = "指标录入单子", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response,DcBusiTargetInputSub DcBusiTargetInputSub) |
|||
{ |
|||
List<DcBusiTargetInputSub> list = dcBusiTargetInputSubService.selectDcBusiTargetInputSubList(DcBusiTargetInputSub); |
|||
ExcelUtil<DcBusiTargetInputSub> util = new ExcelUtil<DcBusiTargetInputSub>(DcBusiTargetInputSub.class); |
|||
util.exportExcel(response, list, "指标录入单子数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取指标录入单子详细信息 |
|||
*/ |
|||
@ApiOperation("获取指标录入单子详细信息") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputSub:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return success(dcBusiTargetInputSubService.selectDcBusiTargetInputSubById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增指标录入单子 |
|||
*/ |
|||
@ApiOperation("新增指标录入单子") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputSub", value = "", dataType = "DcBusiTargetInputSub", dataTypeClass = DcBusiTargetInputSub.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputSub:add')") |
|||
@Log(title = "指标录入单子", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcBusiTargetInputSub DcBusiTargetInputSub) |
|||
{ |
|||
return toAjax(dcBusiTargetInputSubService.insertDcBusiTargetInputSub(DcBusiTargetInputSub)); |
|||
} |
|||
|
|||
/** |
|||
* 修改指标录入单子 |
|||
*/ |
|||
|
|||
@ApiOperation("修改指标录入单子") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "DcBusiTargetInputSub", value = "", dataType = "DcBusiTargetInputSub", dataTypeClass = DcBusiTargetInputSub.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputSub:edit')") |
|||
@Log(title = "指标录入单子", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcBusiTargetInputSub DcBusiTargetInputSub) |
|||
{ |
|||
return toAjax(dcBusiTargetInputSubService.updateDcBusiTargetInputSub(DcBusiTargetInputSub)); |
|||
} |
|||
|
|||
/** |
|||
* 删除指标录入单子 |
|||
*/ |
|||
@ApiOperation("删除指标录入单子") |
|||
@ApiImplicitParams({ |
|||
@ApiImplicitParam(name = "ids", value = "", dataType = "Long", dataTypeClass =Long.class), |
|||
}) |
|||
@PreAuthorize("@ss.hasPermi('bill:DcBusiTargetInputSub:remove')") |
|||
@Log(title = "指标录入单子", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcBusiTargetInputSubService.deleteDcBusiTargetInputSubByIds(ids)); |
|||
} |
|||
} |
@ -0,0 +1,110 @@ |
|||
package com.lzbi.bill.domain; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import lombok.Data; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.experimental.Accessors; |
|||
import com.lzbi.common.annotation.Excel; |
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
|
|||
/** |
|||
* 指标录入单对象 dc_busi_target_input_master |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
@Data |
|||
@Accessors(chain = true) |
|||
public class DcBusiTargetInputMaster extends BaseModuleEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 单据号 */ |
|||
@Excel(name = "单据号") |
|||
@ApiModelProperty(name = "单据号",notes = "billSerial") |
|||
private String billSerial; |
|||
|
|||
/** 单据类别 */ |
|||
@Excel(name = "单据类别") |
|||
@ApiModelProperty(name = "单据类别",notes = "biilType") |
|||
private String biilType; |
|||
|
|||
/** 公司ID */ |
|||
@Excel(name = "公司ID") |
|||
@ApiModelProperty(name = "公司ID",notes = "companyId") |
|||
private Long companyId; |
|||
|
|||
/** 公司名称 */ |
|||
@Excel(name = "公司名称") |
|||
@ApiModelProperty(name = "公司名称",notes = "companyName") |
|||
private String companyName; |
|||
|
|||
/** 组织机构名称 */ |
|||
@Excel(name = "组织机构名称") |
|||
@ApiModelProperty(name = "组织机构名称",notes = "organizeName") |
|||
private String organizeName; |
|||
|
|||
/** 组织机构ID */ |
|||
@Excel(name = "组织机构ID") |
|||
@ApiModelProperty(name = "组织机构ID",notes = "oragnizeId") |
|||
private Long oragnizeId; |
|||
|
|||
/** 统计单元编码 */ |
|||
@Excel(name = "统计单元编码") |
|||
@ApiModelProperty(name = "统计单元编码",notes = "assetCode") |
|||
private String assetCode; |
|||
|
|||
/** 统计单元名称 */ |
|||
@Excel(name = "统计单元名称") |
|||
@ApiModelProperty(name = "统计单元名称",notes = "assetName") |
|||
private String assetName; |
|||
|
|||
/** 统计专业代码 */ |
|||
@Excel(name = "统计专业代码") |
|||
@ApiModelProperty(name = "统计专业代码",notes = "fieldCode") |
|||
private String fieldCode; |
|||
|
|||
/** 统计专业名称 */ |
|||
@Excel(name = "统计专业名称") |
|||
@ApiModelProperty(name = "统计专业名称",notes = "fieldName") |
|||
private String fieldName; |
|||
|
|||
/** 主键 */ |
|||
private Long id; |
|||
|
|||
/** 年 */ |
|||
@Excel(name = "年") |
|||
@ApiModelProperty(name = "年",notes = "year") |
|||
private String year; |
|||
|
|||
/** 月 */ |
|||
@Excel(name = "月") |
|||
@ApiModelProperty(name = "月",notes = "month") |
|||
private String month; |
|||
|
|||
/** 创建人 */ |
|||
private String createdBy; |
|||
|
|||
/** 创建时间 */ |
|||
private Date createdTime; |
|||
|
|||
/** 更新人 */ |
|||
private String updatedBy; |
|||
|
|||
/** 更新时间 */ |
|||
private Date updatedTime; |
|||
|
|||
/** 审核状态;0待审核 1 已经审核 2已处理 */ |
|||
@Excel(name = "审核状态;0待审核 1 已经审核 2已处理") |
|||
@ApiModelProperty(name = "审核状态;0待审核 1 已经审核 2已处理",notes = "checkStatus") |
|||
private String checkStatus; |
|||
|
|||
/** 审核类型;1人工2自动 */ |
|||
@Excel(name = "审核类型;1人工2自动") |
|||
@ApiModelProperty(name = "审核类型;1人工2自动",notes = "checkType") |
|||
private String checkType; |
|||
|
|||
} |
@ -0,0 +1,111 @@ |
|||
package com.lzbi.bill.domain; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import lombok.Data; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.experimental.Accessors; |
|||
import com.lzbi.common.annotation.Excel; |
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
|
|||
/** |
|||
* 指标录入单子对象 dc_busi_target_input_sub |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
@Data |
|||
@Accessors(chain = true) |
|||
public class DcBusiTargetInputSub extends BaseModuleEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 创建人 */ |
|||
private String createdBy; |
|||
|
|||
/** 创建时间 */ |
|||
private Date createdTime; |
|||
|
|||
/** 更新人 */ |
|||
private String updatedBy; |
|||
|
|||
/** 更新时间 */ |
|||
private Date updatedTime; |
|||
|
|||
/** 主键 */ |
|||
private Long id; |
|||
|
|||
/** 主单据编号 */ |
|||
@Excel(name = "主单据编号") |
|||
@ApiModelProperty(name = "主单据编号",notes = "billNoMaster") |
|||
private String billNoMaster; |
|||
|
|||
/** 指标编码 */ |
|||
@Excel(name = "指标编码") |
|||
@ApiModelProperty(name = "指标编码",notes = "targetCode") |
|||
private String targetCode; |
|||
|
|||
/** 指标名称 */ |
|||
@Excel(name = "指标名称") |
|||
@ApiModelProperty(name = "指标名称",notes = "targetName") |
|||
private String targetName; |
|||
|
|||
/** 指标单位 */ |
|||
@Excel(name = "指标单位") |
|||
@ApiModelProperty(name = "指标单位",notes = "tagetUnit") |
|||
private String tagetUnit; |
|||
|
|||
/** 日 */ |
|||
@Excel(name = "日") |
|||
@ApiModelProperty(name = "日",notes = "day") |
|||
private String day; |
|||
|
|||
/** 结果值 */ |
|||
@Excel(name = "结果值") |
|||
@ApiModelProperty(name = "结果值",notes = "valResult") |
|||
private BigDecimal valResult; |
|||
|
|||
/** 公司ID */ |
|||
@Excel(name = "公司ID") |
|||
@ApiModelProperty(name = "公司ID",notes = "companyId") |
|||
private Long companyId; |
|||
|
|||
/** 公司名称 */ |
|||
@Excel(name = "公司名称") |
|||
@ApiModelProperty(name = "公司名称",notes = "companyName") |
|||
private String companyName; |
|||
|
|||
/** 组织机构名称 */ |
|||
@Excel(name = "组织机构名称") |
|||
@ApiModelProperty(name = "组织机构名称",notes = "organizeName") |
|||
private String organizeName; |
|||
|
|||
/** 组织机构ID */ |
|||
@Excel(name = "组织机构ID") |
|||
@ApiModelProperty(name = "组织机构ID",notes = "oragnizeId") |
|||
private Long oragnizeId; |
|||
|
|||
/** 统计单元编码 */ |
|||
@Excel(name = "统计单元编码") |
|||
@ApiModelProperty(name = "统计单元编码",notes = "assetCode") |
|||
private String assetCode; |
|||
|
|||
/** 统计单元名称 */ |
|||
@Excel(name = "统计单元名称") |
|||
@ApiModelProperty(name = "统计单元名称",notes = "assetName") |
|||
private String assetName; |
|||
|
|||
/** 统计专业代码 */ |
|||
@Excel(name = "统计专业代码") |
|||
@ApiModelProperty(name = "统计专业代码",notes = "fieldCode") |
|||
private String fieldCode; |
|||
|
|||
/** 统计专业名称 */ |
|||
@Excel(name = "统计专业名称") |
|||
@ApiModelProperty(name = "统计专业名称",notes = "fieldName") |
|||
private String fieldName; |
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.lzbi.bill.mapper; |
|||
|
|||
import java.util.List; |
|||
import com.lzbi.bill.domain.DcBusiTargetInputMaster; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* 指标录入单Mapper接口 |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
|
|||
public interface DcBusiTargetInputMasterMapper extends BaseMapper<DcBusiTargetInputMaster> |
|||
{ |
|||
/** |
|||
* 查询指标录入单 |
|||
* |
|||
* @param id 指标录入单主键 |
|||
* @return 指标录入单 |
|||
*/ |
|||
public DcBusiTargetInputMaster selectDcBusiTargetInputMasterById(Long id); |
|||
|
|||
/** |
|||
* 查询指标录入单列表 |
|||
* |
|||
* @param dcBusiTargetInputMaster 指标录入单 |
|||
* @return 指标录入单集合 |
|||
*/ |
|||
public List<DcBusiTargetInputMaster> selectDcBusiTargetInputMasterList(DcBusiTargetInputMaster dcBusiTargetInputMaster); |
|||
|
|||
/** |
|||
* 新增指标录入单 |
|||
* |
|||
* @param dcBusiTargetInputMaster 指标录入单 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertDcBusiTargetInputMaster(DcBusiTargetInputMaster dcBusiTargetInputMaster); |
|||
|
|||
/** |
|||
* 修改指标录入单 |
|||
* |
|||
* @param dcBusiTargetInputMaster 指标录入单 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateDcBusiTargetInputMaster(DcBusiTargetInputMaster dcBusiTargetInputMaster); |
|||
|
|||
/** |
|||
* 删除指标录入单 |
|||
* |
|||
* @param id 指标录入单主键 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteDcBusiTargetInputMasterById(Long id); |
|||
|
|||
/** |
|||
* 批量删除指标录入单 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteDcBusiTargetInputMasterByIds(Long[] ids); |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.lzbi.bill.mapper; |
|||
|
|||
import java.util.List; |
|||
import com.lzbi.bill.domain.DcBusiTargetInputSub; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* 指标录入单子Mapper接口 |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
|
|||
public interface DcBusiTargetInputSubMapper extends BaseMapper<DcBusiTargetInputSub> |
|||
{ |
|||
/** |
|||
* 查询指标录入单子 |
|||
* |
|||
* @param id 指标录入单子主键 |
|||
* @return 指标录入单子 |
|||
*/ |
|||
public DcBusiTargetInputSub selectDcBusiTargetInputSubById(Long id); |
|||
|
|||
/** |
|||
* 查询指标录入单子列表 |
|||
* |
|||
* @param dcBusiTargetInputSub 指标录入单子 |
|||
* @return 指标录入单子集合 |
|||
*/ |
|||
public List<DcBusiTargetInputSub> selectDcBusiTargetInputSubList(DcBusiTargetInputSub dcBusiTargetInputSub); |
|||
|
|||
/** |
|||
* 新增指标录入单子 |
|||
* |
|||
* @param dcBusiTargetInputSub 指标录入单子 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertDcBusiTargetInputSub(DcBusiTargetInputSub dcBusiTargetInputSub); |
|||
|
|||
/** |
|||
* 修改指标录入单子 |
|||
* |
|||
* @param dcBusiTargetInputSub 指标录入单子 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateDcBusiTargetInputSub(DcBusiTargetInputSub dcBusiTargetInputSub); |
|||
|
|||
/** |
|||
* 删除指标录入单子 |
|||
* |
|||
* @param id 指标录入单子主键 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteDcBusiTargetInputSubById(Long id); |
|||
|
|||
/** |
|||
* 批量删除指标录入单子 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteDcBusiTargetInputSubByIds(Long[] ids); |
|||
} |
@ -0,0 +1,255 @@ |
|||
package com.lzbi.bill.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.lzbi.asset.domain.DcBaseAssetInfo; |
|||
import com.lzbi.asset.mapper.DcBaseAssetInfoMapper; |
|||
import com.lzbi.bill.domain.DcBusiTargetInputMaster; |
|||
import com.lzbi.bill.domain.DcBusiTargetInputSub; |
|||
import com.lzbi.bill.mapper.DcBusiTargetInputMasterMapper; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import com.lzbi.draft.domain.req.ConfirmReq; |
|||
import com.lzbi.draft.domain.req.ProductionDailySheetReq; |
|||
import com.lzbi.draft.domain.vo.ProductionDailySheetVO; |
|||
import com.lzbi.targetFolder.domain.DcBaseAssetTarget; |
|||
import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper; |
|||
import org.apache.commons.collections4.IteratorUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.apache.poi.ss.usermodel.Cell; |
|||
import org.apache.poi.ss.usermodel.DataFormatter; |
|||
import org.apache.poi.xssf.usermodel.XSSFRow; |
|||
import org.apache.poi.xssf.usermodel.XSSFSheet; |
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.CollectionUtils; |
|||
import org.springframework.util.ObjectUtils; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 指标录入单Service业务层处理 |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
@Service |
|||
public class DcBusiTargetInputMasterService extends ServiceImpl<DcBusiTargetInputMasterMapper, DcBusiTargetInputMaster> implements IService<DcBusiTargetInputMaster> |
|||
{ |
|||
|
|||
@Resource |
|||
private DcBaseAssetInfoMapper dcBaseAssetInfoMapper; |
|||
|
|||
@Resource |
|||
private DcBaseAssetTargetMapper dcBaseAssetTargetMapper; |
|||
|
|||
/** |
|||
* 查询指标录入单 |
|||
* |
|||
* @param id 指标录入单主键 |
|||
* @return 指标录入单 |
|||
*/ |
|||
public DcBusiTargetInputMaster selectDcBusiTargetInputMasterById(Long id) |
|||
{ |
|||
return baseMapper.selectDcBusiTargetInputMasterById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询指标录入单列表 |
|||
* |
|||
* @param dcBusiTargetInputMaster 指标录入单 |
|||
* @return 指标录入单 |
|||
*/ |
|||
public List<DcBusiTargetInputMaster> selectDcBusiTargetInputMasterList(DcBusiTargetInputMaster dcBusiTargetInputMaster) |
|||
{ |
|||
return baseMapper.selectDcBusiTargetInputMasterList(dcBusiTargetInputMaster); |
|||
} |
|||
|
|||
/** |
|||
* 新增指标录入单 |
|||
* |
|||
* @param dcBusiTargetInputMaster 指标录入单 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int insertDcBusiTargetInputMaster(DcBusiTargetInputMaster dcBusiTargetInputMaster) |
|||
{ |
|||
dcBusiTargetInputMaster.setCreatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.insertDcBusiTargetInputMaster(dcBusiTargetInputMaster); |
|||
} |
|||
|
|||
/** |
|||
* 修改指标录入单 |
|||
* |
|||
* @param dcBusiTargetInputMaster 指标录入单 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int updateDcBusiTargetInputMaster(DcBusiTargetInputMaster dcBusiTargetInputMaster) |
|||
{ |
|||
dcBusiTargetInputMaster.setUpdatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.updateDcBusiTargetInputMaster(dcBusiTargetInputMaster); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除指标录入单 |
|||
* |
|||
* @param ids 需要删除的指标录入单主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteDcBusiTargetInputMasterByIds(Long[] ids) |
|||
{ |
|||
return baseMapper.deleteDcBusiTargetInputMasterByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除指标录入单信息 |
|||
* |
|||
* @param id 指标录入单主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteDcBusiTargetInputMasterById(Long id) |
|||
{ |
|||
return baseMapper.deleteDcBusiTargetInputMasterById(id); |
|||
} |
|||
|
|||
public AjaxResult uploadProductionDaily(MultipartFile file) { |
|||
List<ProductionDailySheetVO> list = new ArrayList<>(); |
|||
InputStream inputStream = null; |
|||
try { |
|||
inputStream = file.getInputStream(); |
|||
XSSFWorkbook hssfWorkbook = new XSSFWorkbook(inputStream); |
|||
int numberOfSheets = hssfWorkbook.getNumberOfSheets(); |
|||
DataFormatter formatter = new DataFormatter(); |
|||
for (int j = 0; j < numberOfSheets; j++) { |
|||
XSSFSheet sheetAt = hssfWorkbook.getSheetAt(j); |
|||
String sheetName = sheetAt.getSheetName(); |
|||
//获取数据总行数
|
|||
int rows = sheetAt.getPhysicalNumberOfRows(); |
|||
List<List<String>> data = new ArrayList<>(); |
|||
//每行数据处理
|
|||
for (int i = 0; i < rows; i++) { |
|||
//获取一行数据
|
|||
XSSFRow row = sheetAt.getRow(i); |
|||
if (null != row) { |
|||
List<Cell> cells = IteratorUtils.toList(row.cellIterator()); |
|||
List<String> cellList = new ArrayList<>(); |
|||
for (int i1 = 0, len1 = cells.size(); i1 < len1; i1++) { |
|||
cellList.add(formatter.formatCellValue(cells.get(i1))); |
|||
} |
|||
data.add(cellList); |
|||
} |
|||
} |
|||
list.add(new ProductionDailySheetVO(j, sheetName, data)); |
|||
} |
|||
return AjaxResult.success(list); |
|||
} catch (Exception e) { |
|||
log.error("文件解析异常", e); |
|||
return AjaxResult.error(); |
|||
} finally { |
|||
try { |
|||
if (null != inputStream) { |
|||
inputStream.close(); |
|||
} |
|||
} catch (IOException e) { |
|||
log.error("文件解析异常", e); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public AjaxResult confirm(ConfirmReq confirmReq) { |
|||
List<DcBusiTargetInputSub> result = new ArrayList<>(); |
|||
List<ProductionDailySheetReq> list = confirmReq.getList(); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return AjaxResult.error("请选择需要保存的热源数据"); |
|||
} |
|||
Map<String, DcBaseAssetInfo> assetMap = new HashMap<>(); |
|||
Map<String, Map<String, DcBaseAssetTarget>> targetMap = new HashMap<>(); |
|||
for (ProductionDailySheetReq productionDailySheetReq : list) { |
|||
String name = productionDailySheetReq.getName(); |
|||
DcBaseAssetInfo dcBaseAssetInfo = dcBaseAssetInfoMapper.selectDcBaseAssetInfoByAliasName(name); |
|||
if (ObjectUtils.isEmpty(dcBaseAssetInfo)) { |
|||
return AjaxResult.error(name + "sheet页没有对应的统计单元"); |
|||
} |
|||
DcBaseAssetTarget params = new DcBaseAssetTarget(); |
|||
params.setAssetCode(dcBaseAssetInfo.getAssetCode()); |
|||
List<DcBaseAssetTarget> dcBaseAssetTargets = dcBaseAssetTargetMapper.selectDcBaseAssetTargetList(params); |
|||
if (CollectionUtils.isEmpty(dcBaseAssetTargets)) { |
|||
return AjaxResult.error(name + "sheet页没有对应的指标"); |
|||
} |
|||
Map<String, DcBaseAssetTarget> targetMap1 = new HashMap<>(); |
|||
dcBaseAssetTargets.forEach(dcBaseAssetTarget -> targetMap1.put(dcBaseAssetTarget.getTargetName(), dcBaseAssetTarget)); |
|||
targetMap.put(name, targetMap1); |
|||
assetMap.put(name, dcBaseAssetInfo); |
|||
} |
|||
for (ProductionDailySheetReq productionDailySheetReq : list) { |
|||
String name = productionDailySheetReq.getName(); |
|||
DcBaseAssetInfo dcBaseAssetInfo = assetMap.get(name); |
|||
Map<String, DcBaseAssetTarget> dcBaseAssetTargetMap = targetMap.get(name); |
|||
List<List<String>> data = productionDailySheetReq.getData(); |
|||
if (!CollectionUtils.isEmpty(data)) { |
|||
Map<Integer, Integer> dayMap = new HashMap<>(); |
|||
boolean sign = false; |
|||
for (int i = 0, leni = data.size(); i < leni; i++) { |
|||
List<String> row = data.get(i); |
|||
if ("日期".equals(row.get(0))) { |
|||
Map<String, Integer> columnMap = new HashMap<>(); |
|||
int lenj = row.size(); |
|||
for (int j = 1; j < lenj; j++) { |
|||
if (!columnMap.containsKey(row.get(j))) { |
|||
columnMap.put(row.get(j), j); |
|||
} |
|||
} |
|||
for (int j = 1; j <= 31 && j < lenj; j++) { |
|||
String key = j + "日"; |
|||
if (columnMap.containsKey(key) && !dayMap.containsKey(key)) { |
|||
dayMap.put(j, columnMap.get(key)); |
|||
} |
|||
} |
|||
sign = true; |
|||
continue; |
|||
} |
|||
if (sign) { |
|||
String column = row.get(0); |
|||
if (StringUtils.isBlank(column)) { |
|||
break; |
|||
} |
|||
DcBaseAssetTarget dcBaseAssetTarget = dcBaseAssetTargetMap.get(column); |
|||
if (!ObjectUtils.isEmpty(dcBaseAssetTarget)) { |
|||
dayMap.forEach((day, index) -> { |
|||
String v = row.get(index); |
|||
if (StringUtils.isNotBlank(v)) { |
|||
DcBusiTargetInputSub dcBusiTargetInputSub = new DcBusiTargetInputSub(); |
|||
BeanUtils.copyProperties(dcBaseAssetTarget, dcBusiTargetInputSub); |
|||
dcBusiTargetInputSub.setAssetCode(dcBaseAssetInfo.getAssetCode()); |
|||
dcBusiTargetInputSub.setAssetName(dcBaseAssetInfo.getAssetName()); |
|||
dcBusiTargetInputSub.setCompanyId(dcBaseAssetInfo.getComanyId()); |
|||
dcBusiTargetInputSub.setOragnizeId(dcBaseAssetInfo.getOrgId()); |
|||
// dcBusiTargetInputSub.setCompanyName();
|
|||
// dcBusiTargetInputSub.setOrganizeName();
|
|||
dcBusiTargetInputSub.setTagetUnit(dcBaseAssetTarget.getFieldUnit()); |
|||
dcBusiTargetInputSub.setDay(String.valueOf(day)); |
|||
dcBusiTargetInputSub.setValResult(new BigDecimal(v)); |
|||
result.add(dcBusiTargetInputSub); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
return AjaxResult.success(result); |
|||
} |
|||
} |
@ -0,0 +1,91 @@ |
|||
package com.lzbi.bill.service; |
|||
|
|||
import java.util.List; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import com.lzbi.bill.domain.DcBusiTargetInputSub; |
|||
import com.lzbi.bill.mapper.DcBusiTargetInputSubMapper; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
/** |
|||
* 指标录入单子Service业务层处理 |
|||
* |
|||
* @author lienbo |
|||
* @date 2024-01-19 |
|||
*/ |
|||
@Service |
|||
public class DcBusiTargetInputSubService extends ServiceImpl<DcBusiTargetInputSubMapper, DcBusiTargetInputSub> implements IService<DcBusiTargetInputSub> |
|||
{ |
|||
|
|||
/** |
|||
* 查询指标录入单子 |
|||
* |
|||
* @param id 指标录入单子主键 |
|||
* @return 指标录入单子 |
|||
*/ |
|||
public DcBusiTargetInputSub selectDcBusiTargetInputSubById(Long id) |
|||
{ |
|||
return baseMapper.selectDcBusiTargetInputSubById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询指标录入单子列表 |
|||
* |
|||
* @param dcBusiTargetInputSub 指标录入单子 |
|||
* @return 指标录入单子 |
|||
*/ |
|||
public List<DcBusiTargetInputSub> selectDcBusiTargetInputSubList(DcBusiTargetInputSub dcBusiTargetInputSub) |
|||
{ |
|||
return baseMapper.selectDcBusiTargetInputSubList(dcBusiTargetInputSub); |
|||
} |
|||
|
|||
/** |
|||
* 新增指标录入单子 |
|||
* |
|||
* @param dcBusiTargetInputSub 指标录入单子 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int insertDcBusiTargetInputSub(DcBusiTargetInputSub dcBusiTargetInputSub) |
|||
{ |
|||
dcBusiTargetInputSub.setCreatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.insertDcBusiTargetInputSub(dcBusiTargetInputSub); |
|||
} |
|||
|
|||
/** |
|||
* 修改指标录入单子 |
|||
* |
|||
* @param dcBusiTargetInputSub 指标录入单子 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int updateDcBusiTargetInputSub(DcBusiTargetInputSub dcBusiTargetInputSub) |
|||
{ |
|||
dcBusiTargetInputSub.setUpdatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.updateDcBusiTargetInputSub(dcBusiTargetInputSub); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除指标录入单子 |
|||
* |
|||
* @param ids 需要删除的指标录入单子主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteDcBusiTargetInputSubByIds(Long[] ids) |
|||
{ |
|||
return baseMapper.deleteDcBusiTargetInputSubByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除指标录入单子信息 |
|||
* |
|||
* @param id 指标录入单子主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteDcBusiTargetInputSubById(Long id) |
|||
{ |
|||
return baseMapper.deleteDcBusiTargetInputSubById(id); |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
package com.lzbi.draft.domain.req; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class ConfirmReq { |
|||
|
|||
private List<ProductionDailySheetReq> list; |
|||
} |
@ -0,0 +1,97 @@ |
|||
package com.lzbi.wechat.controller; |
|||
|
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.wechat.service.DeptService; |
|||
import com.lzbi.wechat.service.TargetService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("/wechat/biz") |
|||
public class BizController { |
|||
|
|||
@Autowired |
|||
@Qualifier("wechatDeptService") |
|||
private DeptService deptService; |
|||
|
|||
@Autowired |
|||
private TargetService targetService; |
|||
|
|||
/** |
|||
* 获取自己所在部门 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/dept/self/list") |
|||
public AjaxResult getSelfDeptList() { |
|||
return AjaxResult.success(deptService.getSelfDeptList()); |
|||
} |
|||
|
|||
/** |
|||
* 获取供热面积 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/heatRadiatingArea") |
|||
public AjaxResult getHeatRadiatingArea(@RequestParam("deptId") Long deptId) { |
|||
return AjaxResult.success(targetService.getHeatRadiatingArea(deptId)); |
|||
} |
|||
|
|||
/** |
|||
* 获取公司指标值 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/comany/target") |
|||
public AjaxResult getComanyTarget(@RequestParam("deptId") Long deptId) { |
|||
return AjaxResult.success(targetService.getComanyTarget(deptId)); |
|||
} |
|||
|
|||
/** |
|||
* 获取热源指标值 |
|||
* @param type 1、单日指标,2、累计指标 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/heatSource/target") |
|||
public AjaxResult getHeatSourceTarget(@RequestParam("deptId") Long deptId, @RequestParam("type") String type) { |
|||
return AjaxResult.success(targetService.getHeatSourceTarget(deptId, type)); |
|||
} |
|||
|
|||
/** |
|||
* 获取换热站参数 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/heatExchangeStation/params") |
|||
public AjaxResult getHeatExchangeStationParams(@RequestParam("deptId") Long deptId) { |
|||
return AjaxResult.success(targetService.getHeatExchangeStationParams(deptId)); |
|||
} |
|||
|
|||
/** |
|||
* 获取完成率 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/finishingRate") |
|||
public AjaxResult getFinishingRate(@RequestParam("deptId") Long deptId) { |
|||
return AjaxResult.success(targetService.getFinishingRate(deptId)); |
|||
} |
|||
|
|||
/** |
|||
* 获取完成率 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/finishingRateLine") |
|||
public AjaxResult getFinishingRateLine(@RequestParam("deptId") Long deptId) { |
|||
return AjaxResult.success(targetService.finishingRateLine(deptId)); |
|||
} |
|||
|
|||
/** |
|||
* 获取下属部门列表 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/dept/children") |
|||
public AjaxResult getDeptChildren(@RequestParam("deptId") Long deptId) { |
|||
return AjaxResult.success(deptService.getDeptChildren(deptId)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.lzbi.wechat.controller; |
|||
|
|||
import com.lzbi.common.constant.Constants; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.core.domain.model.LoginBody; |
|||
import com.lzbi.framework.web.service.SysLoginService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("/wechat/biz/login") |
|||
public class LoginController { |
|||
|
|||
@Autowired |
|||
private SysLoginService loginService; |
|||
|
|||
/** |
|||
* 登录方法 |
|||
* |
|||
* @param loginBody 登录信息 |
|||
* @return 结果 |
|||
*/ |
|||
@PostMapping("/username") |
|||
public AjaxResult login(@RequestBody LoginBody loginBody) |
|||
{ |
|||
AjaxResult ajax = AjaxResult.success(); |
|||
// 生成令牌
|
|||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
|||
loginBody.getUuid()); |
|||
ajax.put(Constants.TOKEN, token); |
|||
return ajax; |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.lzbi.wechat.controller; |
|||
|
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.wechat.domain.req.CodeLoginReq; |
|||
import com.lzbi.wechat.domain.req.PhoneNumberLoginReq; |
|||
import com.lzbi.wechat.domain.req.PhoneNumberReq; |
|||
import com.lzbi.wechat.service.WechatService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 微信服务相关接口控制器 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/wechat/server") |
|||
public class WechatController { |
|||
|
|||
@Autowired |
|||
private WechatService wechatService; |
|||
|
|||
/** |
|||
* 登录凭证登录 |
|||
* @param codeLoginReq |
|||
* @return |
|||
*/ |
|||
@PostMapping("/codeLogin") |
|||
public AjaxResult codeLogin(@Validated @RequestBody CodeLoginReq codeLoginReq) { |
|||
return AjaxResult.success("操作成功", wechatService.codeLogin(codeLoginReq)); |
|||
} |
|||
|
|||
/** |
|||
* 获取手机号 |
|||
* @param phoneNumberReq |
|||
* @return |
|||
*/ |
|||
@PostMapping("/phoneNumber") |
|||
public AjaxResult getPhoneNumber(@Validated @RequestBody PhoneNumberReq phoneNumberReq) { |
|||
return AjaxResult.success("操作成功", wechatService.getPhoneNumber(phoneNumberReq)); |
|||
} |
|||
|
|||
/** |
|||
* 手机号登录 |
|||
* @param phoneNumberLoginReq |
|||
* @return |
|||
*/ |
|||
@PostMapping("/phoneNumberLogin") |
|||
public AjaxResult phoneNumberLogin(@Validated @RequestBody PhoneNumberLoginReq phoneNumberLoginReq) { |
|||
return AjaxResult.success("操作成功", wechatService.phoneNumberLogin(phoneNumberLoginReq)); |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.lzbi.wechat.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 微信用户关系实体类 |
|||
*/ |
|||
@Data |
|||
public class SysWechat { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
/** |
|||
* 微信用户唯一标识 |
|||
*/ |
|||
private String openId; |
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String phone; |
|||
|
|||
public SysWechat() {} |
|||
|
|||
public SysWechat(String openId, String phone) { |
|||
this.openId = openId; |
|||
this.phone = phone; |
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.lzbi.wechat.domain.rep; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 获取接口调用凭据 |
|||
*/ |
|||
@Data |
|||
public class WechatAccessTokenRep extends WechatBaseRep{ |
|||
|
|||
private String access_token; |
|||
|
|||
private Long expires_in; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.lzbi.wechat.domain.rep; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 微信接口返回值 |
|||
*/ |
|||
@Data |
|||
public class WechatBaseRep { |
|||
|
|||
/** |
|||
* 错误码 |
|||
*/ |
|||
private Integer errcode; |
|||
/** |
|||
* 错误信息 |
|||
*/ |
|||
private String errmsg; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.lzbi.wechat.domain.rep; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 微信登录凭证登录返回值 |
|||
*/ |
|||
@Data |
|||
public class WechatCodeLoginRep extends WechatBaseRep { |
|||
|
|||
/** |
|||
* 会话密钥 |
|||
*/ |
|||
private String session_key; |
|||
/** |
|||
* 用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台账号下会返回 |
|||
*/ |
|||
private String unionid; |
|||
/** |
|||
* 用户唯一标识 |
|||
*/ |
|||
private String openid; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.lzbi.wechat.domain.rep; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 获取手机号返回值 |
|||
*/ |
|||
@Data |
|||
public class WechatPhoneNumberRep extends WechatBaseRep { |
|||
|
|||
/** |
|||
* 手机号信息 |
|||
*/ |
|||
private PhoneInfo phone_info; |
|||
|
|||
/** |
|||
* 手机号信息 |
|||
*/ |
|||
@Data |
|||
public static class PhoneInfo { |
|||
|
|||
private String phoneNumber; |
|||
|
|||
private String purePhoneNumber; |
|||
|
|||
private String countryCode; |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.lzbi.wechat.domain.req; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 微信授权登录请求参数 |
|||
*/ |
|||
@Data |
|||
public class CodeLoginReq { |
|||
|
|||
/** |
|||
* 登录时获取的 code,可通过wx.login获取 |
|||
*/ |
|||
@NotBlank(message = "登录凭证不能为空") |
|||
private String code; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.lzbi.wechat.domain.req; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 手机号登录请求参数 |
|||
*/ |
|||
@Data |
|||
public class PhoneNumberLoginReq { |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String phone; |
|||
/** |
|||
* 微信用户唯一标识 |
|||
*/ |
|||
private String openId; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.lzbi.wechat.domain.req; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 获取手机号请求参数 |
|||
*/ |
|||
@Data |
|||
public class PhoneNumberReq { |
|||
|
|||
/** |
|||
* 手机号获取凭证 |
|||
*/ |
|||
@NotBlank(message = "手机号获取凭证不能为空") |
|||
private String code; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.lzbi.wechat.domain.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ChildDeptVO { |
|||
|
|||
/** |
|||
* 部门id |
|||
*/ |
|||
private Object deptId; |
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
/** |
|||
* 一次网供温 |
|||
*/ |
|||
private Double temperatureSupply; |
|||
/** |
|||
* 一次网回温 |
|||
*/ |
|||
private Double temperatureComeBack; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.lzbi.wechat.domain.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 登录凭证登录返回值 |
|||
*/ |
|||
@Data |
|||
public class CodeLoginVO { |
|||
|
|||
private String token; |
|||
|
|||
private String openId; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.lzbi.wechat.domain.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 部门返回值 |
|||
*/ |
|||
@Data |
|||
public class DeptVO { |
|||
|
|||
/** |
|||
* 部门id |
|||
*/ |
|||
private Long value; |
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String label; |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.lzbi.wechat.domain.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class FinishingRateVO { |
|||
|
|||
/** |
|||
* 指标怕名称列表 |
|||
*/ |
|||
private List<String> names; |
|||
/** |
|||
* 指标值列表 |
|||
*/ |
|||
private List<Double> values; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.lzbi.wechat.domain.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* 指标返回值 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class TargetVO { |
|||
|
|||
/** |
|||
* 指标编码 |
|||
*/ |
|||
private String targetCode; |
|||
/** |
|||
* 指标名称 |
|||
*/ |
|||
private String targetName; |
|||
/** |
|||
* 指标单位 |
|||
*/ |
|||
private String targetUnit; |
|||
/** |
|||
* 值 |
|||
*/ |
|||
private Double value; |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.lzbi.wechat.mapper; |
|||
|
|||
import com.lzbi.wechat.domain.SysWechat; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* 微信用户关系数据访问层 |
|||
*/ |
|||
public interface SysWechatMapper { |
|||
|
|||
/** |
|||
* 查询微信用户关系 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
SysWechat selectSysWechatById(@Param("id") Long id); |
|||
|
|||
/** |
|||
* 查询微信用户关系 |
|||
* @param openId |
|||
* @return |
|||
*/ |
|||
SysWechat selectWechatByOpenId(@Param("openId") String openId); |
|||
|
|||
/** |
|||
* 增加微信用户关系 |
|||
* @param sysWechat |
|||
* @return |
|||
*/ |
|||
int insertSysWechat(SysWechat sysWechat); |
|||
|
|||
/** |
|||
* 修改微信用户关系 |
|||
* @param sysWechat |
|||
* @return |
|||
*/ |
|||
int updateSysWechat(SysWechat sysWechat); |
|||
|
|||
/** |
|||
* 删除微信用户关系 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
int deleteSysWechat(@Param("id") Long id); |
|||
} |
@ -0,0 +1,92 @@ |
|||
package com.lzbi.wechat.service; |
|||
|
|||
import com.lzbi.common.constant.BizConstants; |
|||
import com.lzbi.common.core.domain.entity.SysDept; |
|||
import com.lzbi.common.core.domain.entity.SysRole; |
|||
import com.lzbi.common.core.domain.entity.SysUser; |
|||
import com.lzbi.common.core.domain.model.LoginUser; |
|||
import com.lzbi.common.utils.SecurityUtils; |
|||
import com.lzbi.system.service.ISysDeptService; |
|||
import com.lzbi.wechat.domain.vo.ChildDeptVO; |
|||
import com.lzbi.wechat.domain.vo.DeptVO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service("wechatDeptService") |
|||
public class DeptService { |
|||
|
|||
@Autowired |
|||
private ISysDeptService sysDeptService; |
|||
|
|||
public List<DeptVO> getSelfDeptList() { |
|||
List<DeptVO> list = new ArrayList<>(); |
|||
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|||
SysUser sysUser = loginUser.getUser(); |
|||
List<SysRole> roles = sysUser.getRoles(); |
|||
List<Long> roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); |
|||
List<SysDept> sysDepts = sysDeptService.selectDeptListByRoleIds(roleIds); |
|||
if (!CollectionUtils.isEmpty(sysDepts)) { |
|||
list = sysDepts.stream().filter(sysDept -> { |
|||
if (BizConstants.DcDeptAttr.COMANY.equals(sysDept.getOrgType())) { |
|||
return true; |
|||
} else { |
|||
return false; |
|||
} |
|||
}).map(sysDept -> { |
|||
DeptVO deptVO = new DeptVO(); |
|||
deptVO.setValue(sysDept.getDeptId()); |
|||
deptVO.setLabel(sysDept.getDeptName()); |
|||
return deptVO; |
|||
}).collect(Collectors.toList()); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
public List<ChildDeptVO> getDeptChildren(Long deptId) { |
|||
List<ChildDeptVO> list = new ArrayList<>(); |
|||
SysDept selfDept = sysDeptService.selectDeptById(deptId); |
|||
String orgType = selfDept.getOrgType(); |
|||
if (BizConstants.DcDeptAttr.COMANY.equals(orgType)) { |
|||
// SysDept query = new SysDept();
|
|||
// query.setParentId(deptId);
|
|||
// query.setOrgType(BizConstants.DcDeptAttr.HEAT_SOURCE);
|
|||
// List<SysDept> sysDeptList = sysDeptService.selectDeptList(query);
|
|||
// if (!CollectionUtils.isEmpty(sysDeptList)) {
|
|||
// list = sysDeptList.stream().map(item -> {
|
|||
// ChildDeptVO childDeptVO = new ChildDeptVO();
|
|||
// childDeptVO.setDeptId(item.getDeptId());
|
|||
// childDeptVO.setDeptName(item.getDeptName());
|
|||
// childDeptVO.setTemperatureSupply(80D);
|
|||
// childDeptVO.setTemperatureComeBack(53D);
|
|||
// return childDeptVO;
|
|||
// }).collect(Collectors.toList());
|
|||
// }
|
|||
list.add(new ChildDeptVO(103L, "1#热源", 80D, 53D)); |
|||
list.add(new ChildDeptVO(104L, "2#热源", 76D, 42D)); |
|||
} else { |
|||
// QueryWrapper<DcBaseAssetInfo> queryWrapper = new QueryWrapper<>();
|
|||
// queryWrapper.eq("orgCode", deptId);
|
|||
// queryWrapper.eq("assetType", BizConstants.DcAssetAttr.HEAT_EXCHANGE_STATION);
|
|||
// List<DcBaseAssetInfo> assetInfoList = dcBaseAssetInfoService.list(queryWrapper);
|
|||
// if (!CollectionUtils.isEmpty(assetInfoList)) {
|
|||
// list = assetInfoList.stream().map(item -> {
|
|||
// ChildDeptVO childDeptVO = new ChildDeptVO();
|
|||
// childDeptVO.setDeptId(item.getAssetCode());
|
|||
// childDeptVO.setDeptName(item.getAssetName());
|
|||
// childDeptVO.setTemperatureSupply(80D);
|
|||
// childDeptVO.setTemperatureComeBack(53D);
|
|||
// return childDeptVO;
|
|||
// }).collect(Collectors.toList());
|
|||
// }
|
|||
list.add(new ChildDeptVO(1L, "大唐管井", 90D, 105D)); |
|||
list.add(new ChildDeptVO(2L, "汪家分局", 80D, 105D)); |
|||
list.add(new ChildDeptVO(3L, "万盈大厦", 90D, 89D)); |
|||
} |
|||
return list; |
|||
} |
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.lzbi.wechat.service; |
|||
|
|||
import com.lzbi.wechat.domain.SysWechat; |
|||
import com.lzbi.wechat.mapper.SysWechatMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* 微信用户关系业务访问层 |
|||
*/ |
|||
@Service |
|||
public class SysWechatService { |
|||
|
|||
@Resource |
|||
private SysWechatMapper sysWechatMapper; |
|||
|
|||
/** |
|||
* 查询微信用户关系 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
public SysWechat selectWechatById(Long id) { |
|||
return sysWechatMapper.selectSysWechatById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询微信用户关系 |
|||
* @param openId |
|||
* @return |
|||
*/ |
|||
public SysWechat selectWechatByOpenId(String openId) { |
|||
return sysWechatMapper.selectWechatByOpenId(openId); |
|||
} |
|||
|
|||
/** |
|||
* 增加微信用户关系 |
|||
* @param sysWechat |
|||
* @return |
|||
*/ |
|||
public int insertWechat(SysWechat sysWechat) { |
|||
return sysWechatMapper.insertSysWechat(sysWechat); |
|||
} |
|||
|
|||
/** |
|||
* 修改微信用户关系 |
|||
* @param sysWechat |
|||
* @return |
|||
*/ |
|||
public int updateWechat(SysWechat sysWechat) { |
|||
return sysWechatMapper.updateSysWechat(sysWechat); |
|||
} |
|||
|
|||
/** |
|||
* 删除微信用户关系 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
public int deleteWechat(Long id) { |
|||
return sysWechatMapper.deleteSysWechat(id); |
|||
} |
|||
} |
@ -0,0 +1,157 @@ |
|||
package com.lzbi.wechat.service; |
|||
|
|||
import com.lzbi.common.constant.BizConstants; |
|||
import com.lzbi.common.core.domain.entity.SysDept; |
|||
import com.lzbi.system.service.ISysDeptService; |
|||
import com.lzbi.wechat.domain.vo.TargetVO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.*; |
|||
|
|||
@Service |
|||
public class TargetService { |
|||
|
|||
@Autowired |
|||
private ISysDeptService sysDeptService; |
|||
|
|||
public Double getHeatRadiatingArea(Long deptId) { |
|||
Double result = 314251101D; |
|||
return result; |
|||
} |
|||
|
|||
public Map<String, TargetVO> getComanyTarget(Long deptId) { |
|||
Map<String, TargetVO> map = new HashMap<>(); |
|||
SysDept selfDept = sysDeptService.selectDeptById(deptId); |
|||
map.put("00023210", new TargetVO("00023210", "总产热量", "GJ", 14123123D)); |
|||
map.put("00023211", new TargetVO("00023211", "水总耗", "GJ", 2697D)); |
|||
map.put("00023212", new TargetVO("00023212", "电总耗", "GJ", 16791D)); |
|||
map.put("00023213", new TargetVO("00023213", "煤总耗", "GJ", 11679D)); |
|||
map.put("00023214", new TargetVO("00023214", "平均单耗", "GJ", 8971D)); |
|||
return map; |
|||
} |
|||
|
|||
public Map<String, TargetVO> getHeatSourceTarget(Long deptId, String type) { |
|||
Map<String, TargetVO> map = new HashMap<>(); |
|||
SysDept selfDept = sysDeptService.selectDeptById(deptId); |
|||
if (BizConstants.TargetType.DAY.equals(type)) { |
|||
map.put("ycwsh", new TargetVO("ycwsh", "一次网水耗", "GJ", 14123123D)); |
|||
map.put("ycwdh", new TargetVO("ycwdh", "一次网电耗", "GJ", 2697D)); |
|||
map.put("ycwmh", new TargetVO("ycwmh", "一次网煤耗", "GJ", 16791D)); |
|||
map.put("zcrl", new TargetVO("zcrl", "总产热量", "GJ", 11679D)); |
|||
map.put("zcql", new TargetVO("zcql", "总产汽量", "GJ", 8971D)); |
|||
map.put("zfdl", new TargetVO("zfdl", "总发电量", "GJ", 14123123D)); |
|||
map.put("ecwsh", new TargetVO("ecwsh", "二次网水耗", "GJ", 2697D)); |
|||
map.put("ecwdh", new TargetVO("ecwdh", "二次网电耗", "GJ", 16791D)); |
|||
map.put("xhll", new TargetVO("xhll", "循环流量", "GJ", 11679D)); |
|||
map.put("ycwgw", new TargetVO("ycwgw", "一次网供温", "GJ", 8971D)); |
|||
map.put("ycwhw", new TargetVO("ycwhw", "一次网回温", "GJ", 8971D)); |
|||
map.put("ycwsdh", new TargetVO("ycwsdh", "一次网水单耗", "GJ", 14123123D)); |
|||
map.put("ycwddh", new TargetVO("ycwddh", "一次网电单耗", "GJ", 2697D)); |
|||
map.put("ycwmdh", new TargetVO("ycwmdh", "一次网煤单耗", "GJ", 16791D)); |
|||
map.put("dcrl", new TargetVO("dcrl", "单产热量", "GJ", 11679D)); |
|||
map.put("dcql", new TargetVO("dcql", "单产汽量", "GJ", 8971D)); |
|||
map.put("dfdl", new TargetVO("dfdl", "单发电量", "GJ", 14123123D)); |
|||
map.put("ecwsdh", new TargetVO("ecwsdh", "二次网水单耗", "GJ", 2697D)); |
|||
map.put("ecwddh", new TargetVO("ecwddh", "二次网电单耗", "GJ", 16791D)); |
|||
} else { |
|||
map.put("ycwshlj", new TargetVO("ycwshlj", "一次网水耗", "GJ", 14123123D)); |
|||
map.put("ycwdhlj", new TargetVO("ycwdhlj", "一次网电耗", "GJ", 2697D)); |
|||
map.put("ycwmhlj", new TargetVO("ycwmhlj", "一次网煤耗", "GJ", 16791D)); |
|||
map.put("zcrllj", new TargetVO("zcrllj", "总产热量", "GJ", 11679D)); |
|||
map.put("zcqllj", new TargetVO("zcqllj", "总产汽量", "GJ", 8971D)); |
|||
map.put("zfdllj", new TargetVO("zfdllj", "总发电量", "GJ", 14123123D)); |
|||
map.put("ecwshlj", new TargetVO("ecwshlj", "二次网水耗", "GJ", 2697D)); |
|||
map.put("ecwdhlj", new TargetVO("ecwdhlj", "二次网电耗", "GJ", 16791D)); |
|||
map.put("xhlllj", new TargetVO("xhllj", "循环流量", "GJ", 11679D)); |
|||
map.put("ycwgwlj", new TargetVO("ycwgwlj", "一次网供温", "GJ", 8971D)); |
|||
map.put("ycwhwlj", new TargetVO("ycwhwlj", "一次网回温", "GJ", 8971D)); |
|||
map.put("ycwsdhlj", new TargetVO("ycwsdhlj", "一次网水单耗", "GJ", 14123123D)); |
|||
map.put("ycwddhlj", new TargetVO("ycwddhlj", "一次网电单耗", "GJ", 2697D)); |
|||
map.put("ycwmdhlj", new TargetVO("ycwmdhlj", "一次网煤单耗", "GJ", 16791D)); |
|||
map.put("dcrllj", new TargetVO("dcrllj", "单产热量", "GJ", 11679D)); |
|||
map.put("dcqllj", new TargetVO("dcqllj", "单产汽量", "GJ", 8971D)); |
|||
map.put("dfdllj", new TargetVO("dfdllj", "单发电量", "GJ", 14123123D)); |
|||
map.put("ecwsdhlj", new TargetVO("ecwsdhlj", "二次网水单耗", "GJ", 2697D)); |
|||
map.put("ecwddhlj", new TargetVO("ecwddhlj", "二次网电单耗", "GJ", 16791D)); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
public Map<String, TargetVO> getHeatExchangeStationParams(Long deptId) { |
|||
Map<String, TargetVO> map = new HashMap<>(); |
|||
map.put("014", new TargetVO("014", "一次网回压", "Mpa", 14123123D)); |
|||
map.put("013", new TargetVO("013", "一次网供压", "Mpa", 2697D)); |
|||
map.put("011", new TargetVO("011", "一次网供温", "°C", 16791D)); |
|||
map.put("012", new TargetVO("012", "一次网回温", "°C", 11679D)); |
|||
map.put("007", new TargetVO("007", "瞬时流量", "m³/h", 8971D)); |
|||
map.put("008", new TargetVO("008", "瞬时热量", "kcal", 14123123D)); |
|||
map.put("009", new TargetVO("009", "累计热量", "kcal", 2697D)); |
|||
map.put("047", new TargetVO("047", "二次网供水压力", "Mpa", 16791D)); |
|||
map.put("048", new TargetVO("048", "二次网回水压力", "Mpa", 11679D)); |
|||
map.put("045", new TargetVO("045", "二次网供水温", "°C", 8971D)); |
|||
map.put("046", new TargetVO("046", "二次网回水温", "°C", 8971D)); |
|||
map.put("001", new TargetVO("001", "电调阀开度给定", "%", 14123123D)); |
|||
map.put("002", new TargetVO("002", "电调阀开度反馈", "%", 2697D)); |
|||
map.put("015", new TargetVO("015", "水箱水位计", "GJ", 16791D)); |
|||
map.put("004", new TargetVO("004", "电调阀控制模式选择", "GJ", 11679D)); |
|||
map.put("003", new TargetVO("003", "电调阀远控/就地", "°C", 8971D)); |
|||
map.put("044", new TargetVO("044", "二次网压差设定", "%", 14123123D)); |
|||
map.put("019", new TargetVO("019", "一次网管道泵上电", "", 2697D)); |
|||
map.put("020", new TargetVO("020", "一次网管道泵下电", "", 16791D)); |
|||
map.put("005", new TargetVO("005", "二次网供温设定", "", 16791D)); |
|||
map.put("018", new TargetVO("018", "一次网管道泵远控/就地", "", 16791D)); |
|||
map.put("021", new TargetVO("021", "一次网管道泵启动", "", 16791D)); |
|||
map.put("010", new TargetVO("010", "热量累计清零", "kwh", 16791D)); |
|||
map.put("017", new TargetVO("017", "总电表", "°C", 16791D)); |
|||
map.put("006", new TargetVO("006", "二次网供回水平均温设定", "m³", 16791D)); |
|||
map.put("031", new TargetVO("031", "水表(累计补水量)", "%", 16791D)); |
|||
map.put("023", new TargetVO("023", "一次网管道泵频率给定", "%", 16791D)); |
|||
map.put("028", new TargetVO("028", "一次网混水电调阀开度给定", "%", 16791D)); |
|||
map.put("029", new TargetVO("029", "一次网混水电调阀开度反馈", "", 16791D)); |
|||
map.put("035", new TargetVO("035", "补水泵1#故障状态", "m³", 16791D)); |
|||
map.put("032", new TargetVO("032", "水表(累计补水量清零)", "", 16791D)); |
|||
map.put("036", new TargetVO("036", "补水泵2#故障状态", "", 16791D)); |
|||
map.put("037", new TargetVO("037", "循环泵远控/就地选择", "", 16791D)); |
|||
map.put("038", new TargetVO("038", "循环泵1#/2#泵选择", "", 16791D)); |
|||
map.put("039", new TargetVO("039", "循环泵控制模式选择", "", 16791D)); |
|||
map.put("025", new TargetVO("025", "一次网管道泵运行/停止状态", "", 16791D)); |
|||
map.put("026", new TargetVO("026", "一次网管道泵故障状态", "", 16791D)); |
|||
map.put("027", new TargetVO("027", "一次网混水电调阀远控/就地", "", 16791D)); |
|||
map.put("033", new TargetVO("033", "补水泵1#运行/停止状态", "", 16791D)); |
|||
map.put("034", new TargetVO("034", "补水泵2#运行/停止状态", "", 16791D)); |
|||
map.put("040", new TargetVO("040", "循环泵变频上电", "", 16791D)); |
|||
map.put("041", new TargetVO("041", "循环泵变频下电", "", 16791D)); |
|||
map.put("042", new TargetVO("042", "循环泵变频启动", "", 16791D)); |
|||
map.put("043", new TargetVO("043", "循环泵变频停止", "", 16791D)); |
|||
map.put("022", new TargetVO("022", "一次网管道泵停止", "", 16791D)); |
|||
map.put("030", new TargetVO("030", "水表(瞬时补水量)", "m³", 16791D)); |
|||
map.put("066", new TargetVO("066", "一次网管道泵启/停", "", 16791D)); |
|||
map.put("024", new TargetVO("024", "一次网管道泵频率反馈", "", 16791D)); |
|||
return map; |
|||
} |
|||
|
|||
public List<List<Object>> getFinishingRate(Long deptId) { |
|||
List<List<Object>> list = new ArrayList<>(); |
|||
List<Object> names = Arrays.asList("name", "水耗", "电耗", "煤耗"); |
|||
List<Object> values = Arrays.asList("总完成率", 90D, 80D, 95D); |
|||
list.add(names); |
|||
list.add(values); |
|||
return list; |
|||
} |
|||
|
|||
public List<List<Object>> finishingRateLine(Long deptId) { |
|||
List<List<Object>> list = new ArrayList<>(); |
|||
List<Object> list1 = Arrays.asList("product", "2012", "2013", "2014", "2015", "2016", "2017"); |
|||
List<Object> list2 = Arrays.asList("Milk Tea", 56.5, 82.1, 88.7, 70.1, 53.4, 85.1); |
|||
List<Object> list3 = Arrays.asList("Matcha Latte", 51.1, 51.4, 55.1, 53.3, 73.8, 68.7); |
|||
List<Object> list4 = Arrays.asList("Cheese Cocoa", 40.1, 62.2, 69.5, 36.4, 45.2, 32.5); |
|||
List<Object> list5 = Arrays.asList("Walnut Brownie", 25.2, 37.1, 41.2, 18, 33.9, 49.1); |
|||
list.add(list1); |
|||
list.add(list2); |
|||
list.add(list3); |
|||
list.add(list4); |
|||
list.add(list5); |
|||
return list; |
|||
} |
|||
} |
@ -0,0 +1,163 @@ |
|||
package com.lzbi.wechat.service; |
|||
|
|||
import com.alibaba.fastjson2.JSONObject; |
|||
import com.lzbi.common.config.WechatConfig; |
|||
import com.lzbi.common.core.domain.entity.SysUser; |
|||
import com.lzbi.common.core.domain.model.LoginUser; |
|||
import com.lzbi.common.core.redis.RedisCache; |
|||
import com.lzbi.common.exception.ServiceException; |
|||
import com.lzbi.framework.web.service.SysLoginService; |
|||
import com.lzbi.framework.web.service.SysPermissionService; |
|||
import com.lzbi.framework.web.service.TokenService; |
|||
import com.lzbi.system.service.ISysUserService; |
|||
import com.lzbi.wechat.domain.SysWechat; |
|||
import com.lzbi.wechat.domain.rep.WechatAccessTokenRep; |
|||
import com.lzbi.wechat.domain.rep.WechatCodeLoginRep; |
|||
import com.lzbi.wechat.domain.rep.WechatPhoneNumberRep; |
|||
import com.lzbi.wechat.domain.req.CodeLoginReq; |
|||
import com.lzbi.wechat.domain.req.PhoneNumberLoginReq; |
|||
import com.lzbi.wechat.domain.req.PhoneNumberReq; |
|||
import com.lzbi.wechat.domain.vo.CodeLoginVO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.ObjectUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.http.HttpEntity; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 微信服务业务逻辑层 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class WechatService { |
|||
|
|||
@Autowired |
|||
private WechatConfig wechatConfig; |
|||
|
|||
@Autowired |
|||
private RestTemplate restTemplate; |
|||
|
|||
@Autowired |
|||
private SysWechatService sysWechatService; |
|||
|
|||
@Autowired |
|||
private ISysUserService sysUserService; |
|||
|
|||
@Autowired |
|||
private SysLoginService sysLoginService; |
|||
|
|||
@Autowired |
|||
private TokenService tokenService; |
|||
|
|||
@Autowired |
|||
private SysPermissionService permissionService; |
|||
|
|||
/** |
|||
* 登录凭证登录 |
|||
* |
|||
* @param codeLoginReq |
|||
* @return |
|||
*/ |
|||
public CodeLoginVO codeLogin(CodeLoginReq codeLoginReq) { |
|||
CodeLoginVO codeLoginVO = new CodeLoginVO(); |
|||
// 微信登录凭证登录请求,获取到open_id
|
|||
Map<String, Object> params = new HashMap<>(); |
|||
params.put("appid", wechatConfig.getAppId()); |
|||
params.put("secret", wechatConfig.getAppSecret()); |
|||
params.put("js_code", codeLoginReq.getCode()); |
|||
params.put("grant_type", "authorization_code"); |
|||
WechatCodeLoginRep resp = restTemplate.getForObject(wechatConfig.getCode2Session(), WechatCodeLoginRep.class, params); |
|||
if (ObjectUtils.isNotEmpty(resp) && 0L == resp.getErrcode()) { |
|||
String openid = resp.getOpenid(); |
|||
codeLoginVO.setOpenId(openid); |
|||
// 根据open_id到数据库中查询sysWechat信息
|
|||
SysWechat sysWechat = sysWechatService.selectWechatByOpenId(openid); |
|||
// 查询到了的话,执行登录操作,返回token
|
|||
if (ObjectUtils.isNotEmpty(sysWechat)) { |
|||
SysUser sysUser = sysUserService.selectUserByPhonenumber(sysWechat.getPhone()); |
|||
if (ObjectUtils.isNotEmpty(sysUser)) { |
|||
String token = this.getToken(sysUser); |
|||
codeLoginVO.setToken(token); |
|||
} |
|||
} |
|||
} else { |
|||
log.error("调用微信服务小程序登录接口时失败,{}, {}", resp.getErrcode(), resp.getErrmsg()); |
|||
throw new ServiceException(resp.getErrmsg(), resp.getErrcode()); |
|||
} |
|||
return codeLoginVO; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public String phoneNumberLogin(PhoneNumberLoginReq phoneNumberLoginReq) { |
|||
// 微信和用户信息绑定
|
|||
SysWechat sysWechat = new SysWechat(phoneNumberLoginReq.getOpenId(), phoneNumberLoginReq.getPhone()); |
|||
int i = sysWechatService.insertWechat(sysWechat); |
|||
if (i > 0) { |
|||
// 获取token
|
|||
SysUser sysUser = sysUserService.selectUserByPhonenumber(sysWechat.getPhone()); |
|||
if (ObjectUtils.isNotEmpty(sysUser)) { |
|||
return this.getToken(sysUser); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 获取手机号 |
|||
* @param phoneNumberReq |
|||
* @return |
|||
*/ |
|||
public String getPhoneNumber(PhoneNumberReq phoneNumberReq) { |
|||
// 获取接口调用凭据
|
|||
Map<String, Object> getAccessTokenParams = new HashMap<>(); |
|||
getAccessTokenParams.put("appid", wechatConfig.getAppId()); |
|||
getAccessTokenParams.put("secret", wechatConfig.getAppSecret()); |
|||
getAccessTokenParams.put("grant_type", "client_credential"); |
|||
WechatAccessTokenRep wechatAccessTokenRep = restTemplate.getForObject(wechatConfig.getAccessToken(), WechatAccessTokenRep.class, getAccessTokenParams); |
|||
if (ObjectUtils.isNotEmpty(wechatAccessTokenRep) && null == wechatAccessTokenRep.getErrcode()) { |
|||
// 获取手机号
|
|||
String accessToken = wechatAccessTokenRep.getAccess_token(); |
|||
Map<String, Object> getPhoneNumberParams = new HashMap<>(); |
|||
getPhoneNumberParams.put("access_token", accessToken); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.setContentType(MediaType.APPLICATION_JSON); |
|||
Map<String, Object> getPhoneNumberBody = new HashMap<>(); |
|||
getPhoneNumberBody.put("code", phoneNumberReq.getCode()); |
|||
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(getPhoneNumberBody), headers); |
|||
WechatPhoneNumberRep resp = restTemplate.postForObject(wechatConfig.getPhoneNumber(), entity, WechatPhoneNumberRep.class, getPhoneNumberParams); |
|||
if (ObjectUtils.isNotEmpty(resp) && 0L == resp.getErrcode()) { |
|||
if (null != resp.getPhone_info()) { |
|||
return resp.getPhone_info().getPurePhoneNumber(); |
|||
} |
|||
} else { |
|||
log.error("调用微信服务获取手机号接口时失败,{}, {}", resp.getErrcode(), resp.getErrmsg()); |
|||
throw new ServiceException(resp.getErrmsg(), resp.getErrcode()); |
|||
} |
|||
} else { |
|||
log.error("调用微信服务获取access_token接口时失败,{}, {}", wechatAccessTokenRep.getErrcode(), wechatAccessTokenRep.getErrmsg()); |
|||
throw new ServiceException(wechatAccessTokenRep.getErrmsg(), wechatAccessTokenRep.getErrcode()); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 获取token |
|||
* @param sysUser |
|||
* @return |
|||
*/ |
|||
private String getToken(SysUser sysUser) { |
|||
LoginUser loginUser = new LoginUser(sysUser.getUserId(), sysUser.getDeptId(), sysUser, permissionService.getMenuPermission(sysUser)); |
|||
sysLoginService.recordLoginInfo(loginUser.getUserId()); |
|||
// 生成token
|
|||
return tokenService.createToken(loginUser); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
<?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.lzbi.wechat.mapper.SysWechatMapper"> |
|||
|
|||
<select id="selectSysWechatById" resultType="com.lzbi.wechat.domain.SysWechat"> |
|||
select id, phone, app_id from sys_wechat where id = #{id} |
|||
</select> |
|||
|
|||
<select id="selectWechatByOpenId" resultType="com.lzbi.wechat.domain.SysWechat"> |
|||
select id, phone, app_id from sys_wechat where open_id = #{openId} |
|||
</select> |
|||
|
|||
<insert id="insertSysWechat" parameterType="com.lzbi.wechat.domain.SysWechat"> |
|||
insert into sys_wechat (open_id, phone) values (#{openId}, #{phone}) |
|||
</insert> |
|||
|
|||
<update id="updateSysWechat"> |
|||
update sys_wechat set open_id = #{openId}, phone = #{phone} where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteSysWechat"> |
|||
delete from sys_wechat where id = #{id} |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,153 @@ |
|||
<?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.lzbi.bill.mapper.DcBusiTargetInputMasterMapper"> |
|||
|
|||
<resultMap type="com.lzbi.bill.domain.DcBusiTargetInputMaster" id="DcBusiTargetInputMasterResult"> |
|||
<result property="billSerial" column="bill_serial" /> |
|||
<result property="biilType" column="biil_type" /> |
|||
<result property="companyId" column="company_id" /> |
|||
<result property="companyName" column="company_name" /> |
|||
<result property="organizeName" column="organize_name" /> |
|||
<result property="oragnizeId" column="oragnize_id" /> |
|||
<result property="assetCode" column="asset_code" /> |
|||
<result property="assetName" column="asset_name" /> |
|||
<result property="fieldCode" column="field_code" /> |
|||
<result property="fieldName" column="field_name" /> |
|||
<result property="id" column="id" /> |
|||
<result property="year" column="year" /> |
|||
<result property="month" column="month" /> |
|||
<result property="tenantId" column="tenant_id" /> |
|||
<result property="revision" column="revision" /> |
|||
<result property="createdBy" column="created_by" /> |
|||
<result property="createdTime" column="created_time" /> |
|||
<result property="updatedBy" column="updated_by" /> |
|||
<result property="updatedTime" column="updated_time" /> |
|||
<result property="deleteBy" column="delete_by" /> |
|||
<result property="deleteTime" column="delete_time" /> |
|||
<result property="checkStatus" column="check_status" /> |
|||
<result property="checkType" column="check_type" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcBusiTargetInputMasterVo"> |
|||
select bill_serial, biil_type, company_id, company_name, organize_name, oragnize_id, asset_code, asset_name, field_code, field_name, id, year, month, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, check_status, check_type from dc_busi_target_input_master |
|||
</sql> |
|||
|
|||
<select id="selectDcBusiTargetInputMasterList" parameterType="DcBusiTargetInputMaster" resultMap="DcBusiTargetInputMasterResult"> |
|||
<include refid="selectDcBusiTargetInputMasterVo"/> |
|||
<where> |
|||
<if test="billSerial != null and billSerial != ''"> and bill_serial = #{billSerial}</if> |
|||
<if test="biilType != null and biilType != ''"> and biil_type = #{biilType}</if> |
|||
<if test="companyId != null "> and company_id = #{companyId}</if> |
|||
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if> |
|||
<if test="organizeName != null and organizeName != ''"> and organize_name like concat('%', #{organizeName}, '%')</if> |
|||
<if test="oragnizeId != null "> and oragnize_id = #{oragnizeId}</if> |
|||
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if> |
|||
<if test="assetName != null and assetName != ''"> and asset_name like concat('%', #{assetName}, '%')</if> |
|||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode}</if> |
|||
<if test="fieldName != null and fieldName != ''"> and field_name like concat('%', #{fieldName}, '%')</if> |
|||
<if test="year != null and year != ''"> and year = #{year}</if> |
|||
<if test="month != null and month != ''"> and month = #{month}</if> |
|||
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if> |
|||
<if test="checkType != null and checkType != ''"> and check_type = #{checkType}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcBusiTargetInputMasterById" parameterType="Long" resultMap="DcBusiTargetInputMasterResult"> |
|||
<include refid="selectDcBusiTargetInputMasterVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertDcBusiTargetInputMaster" parameterType="DcBusiTargetInputMaster" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_busi_target_input_master |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="billSerial != null">bill_serial,</if> |
|||
<if test="biilType != null">biil_type,</if> |
|||
<if test="companyId != null">company_id,</if> |
|||
<if test="companyName != null">company_name,</if> |
|||
<if test="organizeName != null">organize_name,</if> |
|||
<if test="oragnizeId != null">oragnize_id,</if> |
|||
<if test="assetCode != null">asset_code,</if> |
|||
<if test="assetName != null">asset_name,</if> |
|||
<if test="fieldCode != null">field_code,</if> |
|||
<if test="fieldName != null">field_name,</if> |
|||
<if test="year != null">year,</if> |
|||
<if test="month != null">month,</if> |
|||
<if test="tenantId != null">tenant_id,</if> |
|||
<if test="revision != null">revision,</if> |
|||
<if test="createdBy != null">created_by,</if> |
|||
<if test="createdTime != null">created_time,</if> |
|||
<if test="updatedBy != null">updated_by,</if> |
|||
<if test="updatedTime != null">updated_time,</if> |
|||
<if test="deleteBy != null">delete_by,</if> |
|||
<if test="deleteTime != null">delete_time,</if> |
|||
<if test="checkStatus != null">check_status,</if> |
|||
<if test="checkType != null">check_type,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="billSerial != null">#{billSerial},</if> |
|||
<if test="biilType != null">#{biilType},</if> |
|||
<if test="companyId != null">#{companyId},</if> |
|||
<if test="companyName != null">#{companyName},</if> |
|||
<if test="organizeName != null">#{organizeName},</if> |
|||
<if test="oragnizeId != null">#{oragnizeId},</if> |
|||
<if test="assetCode != null">#{assetCode},</if> |
|||
<if test="assetName != null">#{assetName},</if> |
|||
<if test="fieldCode != null">#{fieldCode},</if> |
|||
<if test="fieldName != null">#{fieldName},</if> |
|||
<if test="year != null">#{year},</if> |
|||
<if test="month != null">#{month},</if> |
|||
<if test="tenantId != null">#{tenantId},</if> |
|||
<if test="revision != null">#{revision},</if> |
|||
<if test="createdBy != null">#{createdBy},</if> |
|||
<if test="createdTime != null">#{createdTime},</if> |
|||
<if test="updatedBy != null">#{updatedBy},</if> |
|||
<if test="updatedTime != null">#{updatedTime},</if> |
|||
<if test="deleteBy != null">#{deleteBy},</if> |
|||
<if test="deleteTime != null">#{deleteTime},</if> |
|||
<if test="checkStatus != null">#{checkStatus},</if> |
|||
<if test="checkType != null">#{checkType},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcBusiTargetInputMaster" parameterType="DcBusiTargetInputMaster"> |
|||
update dc_busi_target_input_master |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="billSerial != null">bill_serial = #{billSerial},</if> |
|||
<if test="biilType != null">biil_type = #{biilType},</if> |
|||
<if test="companyId != null">company_id = #{companyId},</if> |
|||
<if test="companyName != null">company_name = #{companyName},</if> |
|||
<if test="organizeName != null">organize_name = #{organizeName},</if> |
|||
<if test="oragnizeId != null">oragnize_id = #{oragnizeId},</if> |
|||
<if test="assetCode != null">asset_code = #{assetCode},</if> |
|||
<if test="assetName != null">asset_name = #{assetName},</if> |
|||
<if test="fieldCode != null">field_code = #{fieldCode},</if> |
|||
<if test="fieldName != null">field_name = #{fieldName},</if> |
|||
<if test="year != null">year = #{year},</if> |
|||
<if test="month != null">month = #{month},</if> |
|||
<if test="tenantId != null">tenant_id = #{tenantId},</if> |
|||
<if test="revision != null">revision = #{revision},</if> |
|||
<if test="createdBy != null">created_by = #{createdBy},</if> |
|||
<if test="createdTime != null">created_time = #{createdTime},</if> |
|||
<if test="updatedBy != null">updated_by = #{updatedBy},</if> |
|||
<if test="updatedTime != null">updated_time = #{updatedTime},</if> |
|||
<if test="deleteBy != null">delete_by = #{deleteBy},</if> |
|||
<if test="deleteTime != null">delete_time = #{deleteTime},</if> |
|||
<if test="checkStatus != null">check_status = #{checkStatus},</if> |
|||
<if test="checkType != null">check_type = #{checkType},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcBusiTargetInputMasterById" parameterType="Long"> |
|||
delete from dc_busi_target_input_master where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcBusiTargetInputMasterByIds" parameterType="String"> |
|||
delete from dc_busi_target_input_master where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,154 @@ |
|||
<?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.lzbi.bill.mapper.DcBusiTargetInputSubMapper"> |
|||
|
|||
<resultMap type="com.lzbi.bill.domain.DcBusiTargetInputSub" id="DcBusiTargetInputSubResult"> |
|||
<result property="tenantId" column="tenant_id" /> |
|||
<result property="revision" column="revision" /> |
|||
<result property="createdBy" column="created_by" /> |
|||
<result property="createdTime" column="created_time" /> |
|||
<result property="updatedBy" column="updated_by" /> |
|||
<result property="updatedTime" column="updated_time" /> |
|||
<result property="deleteBy" column="delete_by" /> |
|||
<result property="deleteTime" column="delete_time" /> |
|||
<result property="id" column="id" /> |
|||
<result property="billNoMaster" column="bill_no_master" /> |
|||
<result property="targetCode" column="target_code" /> |
|||
<result property="targetName" column="target_name" /> |
|||
<result property="tagetUnit" column="taget_unit" /> |
|||
<result property="day" column="day" /> |
|||
<result property="valResult" column="val_result" /> |
|||
<result property="companyId" column="company_id" /> |
|||
<result property="companyName" column="company_name" /> |
|||
<result property="organizeName" column="organize_name" /> |
|||
<result property="oragnizeId" column="oragnize_id" /> |
|||
<result property="assetCode" column="asset_code" /> |
|||
<result property="assetName" column="asset_name" /> |
|||
<result property="fieldCode" column="field_code" /> |
|||
<result property="fieldName" column="field_name" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcBusiTargetInputSubVo"> |
|||
select tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, id, bill_no_master, target_code, target_name, taget_unit, day, val_result, company_id, company_name, organize_name, oragnize_id, asset_code, asset_name, field_code, field_name from dc_busi_target_input_sub |
|||
</sql> |
|||
|
|||
<select id="selectDcBusiTargetInputSubList" parameterType="DcBusiTargetInputSub" resultMap="DcBusiTargetInputSubResult"> |
|||
<include refid="selectDcBusiTargetInputSubVo"/> |
|||
<where> |
|||
<if test="billNoMaster != null and billNoMaster != ''"> and bill_no_master = #{billNoMaster}</if> |
|||
<if test="targetCode != null and targetCode != ''"> and target_code = #{targetCode}</if> |
|||
<if test="targetName != null and targetName != ''"> and target_name like concat('%', #{targetName}, '%')</if> |
|||
<if test="tagetUnit != null and tagetUnit != ''"> and taget_unit = #{tagetUnit}</if> |
|||
<if test="day != null and day != ''"> and day = #{day}</if> |
|||
<if test="valResult != null "> and val_result = #{valResult}</if> |
|||
<if test="companyId != null "> and company_id = #{companyId}</if> |
|||
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if> |
|||
<if test="organizeName != null and organizeName != ''"> and organize_name like concat('%', #{organizeName}, '%')</if> |
|||
<if test="oragnizeId != null "> and oragnize_id = #{oragnizeId}</if> |
|||
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if> |
|||
<if test="assetName != null and assetName != ''"> and asset_name like concat('%', #{assetName}, '%')</if> |
|||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode}</if> |
|||
<if test="fieldName != null and fieldName != ''"> and field_name like concat('%', #{fieldName}, '%')</if> |
|||
</where> |
|||
order by company_id, oragnize_id, asset_code, target_code |
|||
</select> |
|||
|
|||
<select id="selectDcBusiTargetInputSubById" parameterType="Long" resultMap="DcBusiTargetInputSubResult"> |
|||
<include refid="selectDcBusiTargetInputSubVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertDcBusiTargetInputSub" parameterType="DcBusiTargetInputSub" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_busi_target_input_sub |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="tenantId != null">tenant_id,</if> |
|||
<if test="revision != null">revision,</if> |
|||
<if test="createdBy != null">created_by,</if> |
|||
<if test="createdTime != null">created_time,</if> |
|||
<if test="updatedBy != null">updated_by,</if> |
|||
<if test="updatedTime != null">updated_time,</if> |
|||
<if test="deleteBy != null">delete_by,</if> |
|||
<if test="deleteTime != null">delete_time,</if> |
|||
<if test="billNoMaster != null">bill_no_master,</if> |
|||
<if test="targetCode != null">target_code,</if> |
|||
<if test="targetName != null">target_name,</if> |
|||
<if test="tagetUnit != null">taget_unit,</if> |
|||
<if test="day != null">day,</if> |
|||
<if test="valResult != null">val_result,</if> |
|||
<if test="companyId != null">company_id,</if> |
|||
<if test="companyName != null">company_name,</if> |
|||
<if test="organizeName != null">organize_name,</if> |
|||
<if test="oragnizeId != null">oragnize_id,</if> |
|||
<if test="assetCode != null">asset_code,</if> |
|||
<if test="assetName != null">asset_name,</if> |
|||
<if test="fieldCode != null">field_code,</if> |
|||
<if test="fieldName != null">field_name,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="tenantId != null">#{tenantId},</if> |
|||
<if test="revision != null">#{revision},</if> |
|||
<if test="createdBy != null">#{createdBy},</if> |
|||
<if test="createdTime != null">#{createdTime},</if> |
|||
<if test="updatedBy != null">#{updatedBy},</if> |
|||
<if test="updatedTime != null">#{updatedTime},</if> |
|||
<if test="deleteBy != null">#{deleteBy},</if> |
|||
<if test="deleteTime != null">#{deleteTime},</if> |
|||
<if test="billNoMaster != null">#{billNoMaster},</if> |
|||
<if test="targetCode != null">#{targetCode},</if> |
|||
<if test="targetName != null">#{targetName},</if> |
|||
<if test="tagetUnit != null">#{tagetUnit},</if> |
|||
<if test="day != null">#{day},</if> |
|||
<if test="valResult != null">#{valResult},</if> |
|||
<if test="companyId != null">#{companyId},</if> |
|||
<if test="companyName != null">#{companyName},</if> |
|||
<if test="organizeName != null">#{organizeName},</if> |
|||
<if test="oragnizeId != null">#{oragnizeId},</if> |
|||
<if test="assetCode != null">#{assetCode},</if> |
|||
<if test="assetName != null">#{assetName},</if> |
|||
<if test="fieldCode != null">#{fieldCode},</if> |
|||
<if test="fieldName != null">#{fieldName},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcBusiTargetInputSub" parameterType="DcBusiTargetInputSub"> |
|||
update dc_busi_target_input_sub |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="tenantId != null">tenant_id = #{tenantId},</if> |
|||
<if test="revision != null">revision = #{revision},</if> |
|||
<if test="createdBy != null">created_by = #{createdBy},</if> |
|||
<if test="createdTime != null">created_time = #{createdTime},</if> |
|||
<if test="updatedBy != null">updated_by = #{updatedBy},</if> |
|||
<if test="updatedTime != null">updated_time = #{updatedTime},</if> |
|||
<if test="deleteBy != null">delete_by = #{deleteBy},</if> |
|||
<if test="deleteTime != null">delete_time = #{deleteTime},</if> |
|||
<if test="billNoMaster != null">bill_no_master = #{billNoMaster},</if> |
|||
<if test="targetCode != null">target_code = #{targetCode},</if> |
|||
<if test="targetName != null">target_name = #{targetName},</if> |
|||
<if test="tagetUnit != null">taget_unit = #{tagetUnit},</if> |
|||
<if test="day != null">day = #{day},</if> |
|||
<if test="valResult != null">val_result = #{valResult},</if> |
|||
<if test="companyId != null">company_id = #{companyId},</if> |
|||
<if test="companyName != null">company_name = #{companyName},</if> |
|||
<if test="organizeName != null">organize_name = #{organizeName},</if> |
|||
<if test="oragnizeId != null">oragnize_id = #{oragnizeId},</if> |
|||
<if test="assetCode != null">asset_code = #{assetCode},</if> |
|||
<if test="assetName != null">asset_name = #{assetName},</if> |
|||
<if test="fieldCode != null">field_code = #{fieldCode},</if> |
|||
<if test="fieldName != null">field_name = #{fieldName},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcBusiTargetInputSubById" parameterType="Long"> |
|||
delete from dc_busi_target_input_sub where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcBusiTargetInputSubByIds" parameterType="String"> |
|||
delete from dc_busi_target_input_sub where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue