|
|
@@ -9,6 +9,7 @@ import com.ytpm.general.Result;
|
|
|
import com.ytpm.general.ResultTable;
|
|
|
import com.ytpm.middle.dao.AppMapper;
|
|
|
import com.ytpm.middle.dao.EnterpriseMapper;
|
|
|
+import com.ytpm.middle.model.YtAppGrantRecord;
|
|
|
import com.ytpm.middle.model.YtMiddleEnterprise;
|
|
|
import com.ytpm.middle.param.AppForm;
|
|
|
import com.ytpm.middle.param.AppListParam;
|
|
|
@@ -16,8 +17,10 @@ import com.ytpm.middle.param.GrantAppParam;
|
|
|
import com.ytpm.middle.service.AppService;
|
|
|
import com.ytpm.middle.view.AppListVO;
|
|
|
import com.ytpm.middle.view.DropDownVO;
|
|
|
+import com.ytpm.util.IDUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
@@ -53,6 +56,7 @@ public class AppServiceImpl implements AppService {
|
|
|
app.setCreateTime(new Date());
|
|
|
app.setCreateUserId(form.getCreateUserId());
|
|
|
app.setAvailable(1);
|
|
|
+ app.setChargeStatus(0);
|
|
|
appMapper.insertOne(app);
|
|
|
return Result.resultOk(RepMessage.SAVE_SUCCESS);
|
|
|
}
|
|
|
@@ -70,6 +74,7 @@ public class AppServiceImpl implements AppService {
|
|
|
* 应用授权企业
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Result<String> grantApp(GrantAppParam param) {
|
|
|
//查询企业是否存在
|
|
|
YtMiddleEnterprise enterprise = enterpriseMapper.getByCode(param.getCreditCode());
|
|
|
@@ -86,10 +91,32 @@ public class AppServiceImpl implements AppService {
|
|
|
app.setAppId(param.getAppId());
|
|
|
app.setUpdateParam(param.getUserId());
|
|
|
app.setUserId(enterprise.getUserId());
|
|
|
+ app.setGrantType(param.getGrantType());
|
|
|
+ app.setChargeStatus(1);
|
|
|
appMapper.updateById(app);
|
|
|
+ //增加授权记录
|
|
|
+ addGrantAppRecord(param, app);
|
|
|
return Result.resultOk(RepMessage.GRANT_SUCCESS);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 授权应用记录
|
|
|
+ */
|
|
|
+ private void addGrantAppRecord(GrantAppParam param, YtPlatformUserApp app) {
|
|
|
+ YtAppGrantRecord grantRecord = new YtAppGrantRecord();
|
|
|
+ grantRecord.setRecordId(IDUtil.generateFlowID("grant"));
|
|
|
+ grantRecord.setAppId(app.getAppId());
|
|
|
+ grantRecord.setUserId(app.getUserId());
|
|
|
+ grantRecord.setGrantType(param.getGrantType());
|
|
|
+ grantRecord.setSalePrice(app.getSalePrice());
|
|
|
+ grantRecord.setRatio(param.getRatio());
|
|
|
+ grantRecord.setDataCharge(param.getDataCharge());
|
|
|
+ grantRecord.setGrantTime(new Date());
|
|
|
+ grantRecord.setOperateTime(new Date());
|
|
|
+ grantRecord.setOperatorId(param.getUserId());
|
|
|
+ appMapper.addGrantRecord(grantRecord);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改上架应用信息
|
|
|
*/
|