提交 3b165782 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 8f89365e
package com.ibiz.service.web.dto;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.ibiz.core.ps.valuerule.anno.ps.*;
import com.ibiz.core.ps.domain.PS;
import org.springframework.cglib.beans.BeanCopier;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 服务DTO对象[PSDTO]
*/
public class PSDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [CREATEDATE]
*
*/
@PSCreateDateDefault(info = "默认规则")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
private Timestamp createDate;
@JsonIgnore
private boolean createDateDirtyFlag;
/**
* 属性 [PSNAME]
*
*/
@PSPSNameDefault(info = "默认规则")
private String pSName;
@JsonIgnore
private boolean pSNameDirtyFlag;
/**
* 属性 [CREATEMAN]
*
*/
@PSCreateManDefault(info = "默认规则")
private String createMan;
@JsonIgnore
private boolean createManDirtyFlag;
/**
* 属性 [PSID]
*
*/
@PSPSIdDefault(info = "默认规则")
private String pSId;
@JsonIgnore
private boolean pSIdDirtyFlag;
/**
* 属性 [UPDATEDATE]
*
*/
@PSUpdateDateDefault(info = "默认规则")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
private Timestamp updateDate;
@JsonIgnore
private boolean updateDateDirtyFlag;
/**
* 属性 [UPDATEMAN]
*
*/
@PSUpdateManDefault(info = "默认规则")
private String updateMan;
@JsonIgnore
private boolean updateManDirtyFlag;
/**
* 属性 [IMSTATE]
*
*/
@PSImstateDefault(info = "默认规则")
private String imstate;
@JsonIgnore
private boolean imstateDirtyFlag;
/**
* 获取 [CREATEDATE]
*/
@JsonProperty("createdate")
public Timestamp getCreateDate(){
return createDate ;
}
/**
* 设置 [CREATEDATE]
*/
@JsonProperty("createdate")
public void setCreateDate(Timestamp createDate){
this.createDate = createDate ;
this.createDateDirtyFlag = true ;
}
/**
* 获取 [CREATEDATE]脏标记
*/
@JsonIgnore
public boolean getCreateDateDirtyFlag(){
return createDateDirtyFlag ;
}
/**
* 获取 [PSNAME]
*/
@JsonProperty("psname")
public String getPSName(){
return pSName ;
}
/**
* 设置 [PSNAME]
*/
@JsonProperty("psname")
public void setPSName(String pSName){
this.pSName = pSName ;
this.pSNameDirtyFlag = true ;
}
/**
* 获取 [PSNAME]脏标记
*/
@JsonIgnore
public boolean getPSNameDirtyFlag(){
return pSNameDirtyFlag ;
}
/**
* 获取 [CREATEMAN]
*/
@JsonProperty("createman")
public String getCreateMan(){
return createMan ;
}
/**
* 设置 [CREATEMAN]
*/
@JsonProperty("createman")
public void setCreateMan(String createMan){
this.createMan = createMan ;
this.createManDirtyFlag = true ;
}
/**
* 获取 [CREATEMAN]脏标记
*/
@JsonIgnore
public boolean getCreateManDirtyFlag(){
return createManDirtyFlag ;
}
/**
* 获取 [PSID]
*/
@JsonProperty("psid")
public String getPSId(){
return pSId ;
}
/**
* 设置 [PSID]
*/
@JsonProperty("psid")
public void setPSId(String pSId){
this.pSId = pSId ;
this.pSIdDirtyFlag = true ;
}
/**
* 获取 [PSID]脏标记
*/
@JsonIgnore
public boolean getPSIdDirtyFlag(){
return pSIdDirtyFlag ;
}
/**
* 获取 [UPDATEDATE]
*/
@JsonProperty("updatedate")
public Timestamp getUpdateDate(){
return updateDate ;
}
/**
* 设置 [UPDATEDATE]
*/
@JsonProperty("updatedate")
public void setUpdateDate(Timestamp updateDate){
this.updateDate = updateDate ;
this.updateDateDirtyFlag = true ;
}
/**
* 获取 [UPDATEDATE]脏标记
*/
@JsonIgnore
public boolean getUpdateDateDirtyFlag(){
return updateDateDirtyFlag ;
}
/**
* 获取 [UPDATEMAN]
*/
@JsonProperty("updateman")
public String getUpdateMan(){
return updateMan ;
}
/**
* 设置 [UPDATEMAN]
*/
@JsonProperty("updateman")
public void setUpdateMan(String updateMan){
this.updateMan = updateMan ;
this.updateManDirtyFlag = true ;
}
/**
* 获取 [UPDATEMAN]脏标记
*/
@JsonIgnore
public boolean getUpdateManDirtyFlag(){
return updateManDirtyFlag ;
}
/**
* 获取 [IMSTATE]
*/
@JsonProperty("imstate")
public String getImstate(){
return imstate ;
}
/**
* 设置 [IMSTATE]
*/
@JsonProperty("imstate")
public void setImstate(String imstate){
this.imstate = imstate ;
this.imstateDirtyFlag = true ;
}
/**
* 获取 [IMSTATE]脏标记
*/
@JsonIgnore
public boolean getImstateDirtyFlag(){
return imstateDirtyFlag ;
}
public PS toDO() {
PS srfdomain = new PS();
if(getCreateDateDirtyFlag())
srfdomain.setCreateDate(createDate);
if(getPSNameDirtyFlag())
srfdomain.setPSName(pSName);
if(getCreateManDirtyFlag())
srfdomain.setCreateMan(createMan);
if(getPSIdDirtyFlag())
srfdomain.setPSId(pSId);
if(getUpdateDateDirtyFlag())
srfdomain.setUpdateDate(updateDate);
if(getUpdateManDirtyFlag())
srfdomain.setUpdateMan(updateMan);
if(getImstateDirtyFlag())
srfdomain.setImstate(imstate);
return srfdomain;
}
public void fromDO(PS srfdomain) {
if(srfdomain == null )
return ;
if(srfdomain.getCreateDateDirtyFlag())
this.setCreateDate(srfdomain.getCreateDate());
if(srfdomain.getPSNameDirtyFlag())
this.setPSName(srfdomain.getPSName());
if(srfdomain.getCreateManDirtyFlag())
this.setCreateMan(srfdomain.getCreateMan());
if(srfdomain.getPSIdDirtyFlag())
this.setPSId(srfdomain.getPSId());
if(srfdomain.getUpdateDateDirtyFlag())
this.setUpdateDate(srfdomain.getUpdateDate());
if(srfdomain.getUpdateManDirtyFlag())
this.setUpdateMan(srfdomain.getUpdateMan());
if(srfdomain.getImstateDirtyFlag())
this.setImstate(srfdomain.getImstate());
}
public List<PSDTO> fromDOPage(List<PS> poPage) {
if(poPage == null)
return null;
List<PSDTO> dtos=new ArrayList<PSDTO>();
for(PS domain : poPage) {
PSDTO dto = new PSDTO();
dto.fromDO(domain);
dtos.add(dto);
}
return dtos;
}
}
package com.ibiz.service.web.resource;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.domain.PageRequest;
import com.ibiz.service.web.dto.PSDTO;
import com.ibiz.core.ps.domain.PS;
import com.ibiz.core.ps.service.IPSService;
import com.ibiz.util.SearchContext;
import com.ibiz.core.ps.filter.PSSearchContext;
@Api(tags = {"PS" })
@RestController
@RequestMapping("")
public class PSResource {
@Autowired
private IPSService psService;
public IPSService getPsService() {
return this.psService;
}
@ApiOperation(value = "Get", tags = {"PS" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/web/ps/{ps_id}")
public ResponseEntity<PSDTO> get(@PathVariable("ps_id") String ps_id) {
PSDTO dto = new PSDTO();
PS domain = psService.get(ps_id);
dto.fromDO(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "Update", tags = {"PS" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/web/ps/{ps_id}")
public ResponseEntity<PSDTO> update(@PathVariable("ps_id") String ps_id, @RequestBody PSDTO psdto) {
PS domain = psdto.toDO();
domain.setPSId(ps_id);
psService.update(domain);
PSDTO dto = new PSDTO();
dto.fromDO(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "Create", tags = {"PS" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/web/ps")
public ResponseEntity<PSDTO> create(@RequestBody PSDTO psdto) {
PSDTO dto = new PSDTO();
PS domain = psdto.toDO();
psService.create(domain);
dto.fromDO(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "Save", tags = {"PS" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/web/ps/{ps_id}/save")
public ResponseEntity<Boolean> save(@RequestBody PSDTO psdto) {
PS ps = psdto.toDO();
Boolean b = psService.save(ps) ;
return ResponseEntity.status(HttpStatus.OK).body(b);
}
@ApiOperation(value = "GetDraft", tags = {"PS" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/web/ps/{ps_id}/getdraft")
public ResponseEntity<PSDTO> getDraft(@PathVariable("ps_id") String ps_id, @RequestBody PSDTO psdto) {
PS ps = psdto.toDO();
ps = psService.getDraft(ps) ;
psdto.fromDO(ps);
return ResponseEntity.status(HttpStatus.OK).body(psdto);
}
@ApiOperation(value = "CheckKey", tags = {"PS" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/web/ps/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody PSDTO psdto) {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "Remove", tags = {"PS" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/web/ps/{ps_id}")
public ResponseEntity<Boolean> remove(@PathVariable("ps_id") String ps_id) {
PSDTO psdto = new PSDTO();
PS domain = new PS();
psdto.setPSId(ps_id);
domain.setPSId(ps_id);
Boolean rst = psService.remove(domain.getPSId());
if(rst){
return ResponseEntity.status(HttpStatus.OK).body(rst);
}else{
return ResponseEntity.status(HttpStatus.OK).body(rst);
}
}
@ApiOperation(value = "获取DEFAULT", tags = {"PS" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/web/ps/fetchdefault")
public ResponseEntity<Page<PSDTO>> fetchDefault(PSSearchContext context,Pageable pageable ,ServletRequest request) {
context.setPageable(pageable);
List<PSDTO> list = new ArrayList<PSDTO>();
Page<PS> domains = psService.searchDefault(context) ;
for(PS ps : domains.getContent()){
PSDTO dto = new PSDTO();
dto.fromDO(ps);
list.add(dto);
}
return ResponseEntity.status(HttpStatus.OK).body(new PageImpl(list,context.getPageable(),domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册